I am having a rather strange problem, I deployed 2 .NET applications on my machine. Both run on v2.0.
Now, while one of it works smoothly, the other one doesn't even start! Moreover, it doesn't throw any error, I couldn't see any error listings in the Event Viewer.
Becoming hard to debug. On every other machine, both the exe's work perfectly fine!
Any known issues?
EDIT:
I caught an Unhandled Exception and the exception is this;
System.Runtime.InteropServices.COMException (0x80040154): Class not registered(Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
at System.Windows.Forms.UnsafeNativeMethods.CoCreateInstance(Guid& clsid, Object punkOuter, Int32 context, Guid& iid)
at System.Windows.Forms.AxHost.CreateWithoutLicense(Guid clsid)
at System.Windows.Forms.AxHost.CreateWithLicense(String license, Guid clsid)
at System.Windows.Forms.AxHost.CreateInstanceCore(Guid clsid)
at System.Windows.Forms.AxHost.CreateInstance()
at System.Windows.Forms.AxHost.GetOcxCreate()
at System.Windows.Forms.AxHost.TransitionUpTo(Int32 state)
at System.Windows.Forms.AxHost.CreateHandle()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.AxHost.EndInit()
at BrowsingFiles.Form1.InitializeComponent()
at BrowsingFiles.Form1..ctor()
at BrowsingFiles.Program.Main(String[] args)
Thanks
You are calling a COM component that is not registered on that machine.
Ideally, your deployment project would register any COM dependencies: How To Register COM Objects in Visual Studio .NET: Steps to Register a COM Module in a Visual Studio .Net Deployment Project
One more solution apart from the one given by Mitch Wheat
Copy the DLL, in the System32 file at it's proper location and then using command prompt register the dll with the system using
regsvr32 location-of-the-dll
You can go to project -> add reference to add your com component. Make sure you have the com component loaded on this system. You can go and view the references on your previous machine and see where the references are located and modify this new machine accordingly.
Related
I'm having some issues running the Emgu on my server. It runs fine locally, but when I try to use it on the server with IIS, it doesnt work.
Here is the error:
System.TypeInitializationException: The type initializer for 'Emgu.CV.CvInvoke' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'cvextern': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at Emgu.CV.CvInvoke.RedirectError(CvErrorCallback errorHandler, IntPtr userdata, IntPtr prevUserdata)\r\n at Emgu.CV.CvInvoke..cctor()
--- End of inner exception stack trace ---
at Emgu.CV.CvInvoke.cvCreateImageHeader(Size size, IplDepth depth, Int32 channels)
at Emgu.CV.Image`2.AllocateData(Int32 rows, Int32 cols, Int32 numberOfChannels)
at Emgu.CV.Image`2.set_Bitmap(Bitmap value)
at VerifyID.Managers.ImageTreatmentsManager.ExtractDocumentFromImage(Bitmap bitmap)
at VerifyID.VerifyWorker.ExecuteOCR(BigIdRequest request, BigIdEvent bigIdEvent)
I have the following dlls inside the x86 and x64:
concrt140.dll*
liblept172.dll*
msvcp140.dll*
vcruntime140.dll*
cvextern.dll*
libtesseract304.dll*
opencv_ffmpeg320.dll*
IIS version: 10.0
After copying the x64 dlls directly to the bin directory of the build the error changed to:
System.TypeInitializationException: The type initializer for 'Emgu.CV.CvInvoke' threw an exception. ---> System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
at Emgu.CV.CvInvoke.RedirectError(CvErrorCallback errorHandler, IntPtr userdata, IntPtr prevUserdata)
at Emgu.CV.CvInvoke..cctor()
--- End of inner exception stack trace ---
at Emgu.CV.CvInvoke.cvCreateImageHeader(Size size, IplDepth depth, Int32 channels)
at Emgu.CV.Image`2.AllocateData(Int32 rows, Int32 cols, Int32 numberOfChannels)
at Emgu.CV.Image`2.set_Bitmap(Bitmap value)
at VerifyID.Managers.ImageTreatmentsManager.ExtractDocumentFromImage(Bitmap bitmap)
at VerifyID.VerifyWorker.ExecuteOCR(BigIdRequest request, BigIdEvent bigIdEvent)
Could someone help ?
I had this same problem, the application works perfectly on the local server (IIS Express used by the Visual Studio) but not on the remote Windows server, the solution that worked for me was:
(Please test your application between each step, maybe you don't need to do them all)
In Visual Studio, open your application project properties and set the "Platform" to "Any CPU". Then publish your application to the remote server.
Move all .dll files inside the x86 folder to the bin folder, pay special attention to the cvextern.dll, it must be inside the bin folder side by side with your application dll.
Install Visual C++ Redistributable for Visual Studio on the remote server (just google it and you will find the download link. Please choose the download version according to your VS version, 2013, 2015, 2017, 2020, 2050...). Use the x86 installation even if you sever OS is x64.
Activate your app_pool for the application for running 32 bit. https://help.webcontrolcenter.com/kb/a1114/how-to-enable-32-bit-application-pool-iis-7-dedicatedvps.aspx
Go to the application \bin folder, grant the file security for the folder "x86" (which contains all the dll for emgu) as described in the following link "http://www.iis.net/learn/manage/configuring-security/application-pool-identities if your apppool being in used in defaulapppool, then you should add user "IIS AppPool\DefaultAppPool"
I really don't know why the x64 versions of those dlls are not working on the server for me. I still investigating it and as soon I find out why I will update this post.
Another solution (that is not elegant at all, but works) is to install the Visual Studio at the server, doing the same installation process that you have done for your development environment. By doing this you will have all dependencies and dlls needed (including the Visual C++) installed on the server.
Hope it helps!
I'm using the latest version of PostSharp (version 4.1.31.0) in a C# solution with Visual Studio 2015 (with update 1).
Everytime I try to build the solution I get the following error:
Unhandled exception (4.1.31.0, postsharp.srv.4.0-x86.exe, CLR 4.0.30319.394271, Release): System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
I've switched on detailed output when building but haven't been able to spot anything in the output so far!
I have other solutions that work fine with this version so I suspect it is something to do with the solution's configuration.
As an aside, I have also tried version 4.1.30 and get exactly the same error.
Any help or advice on where to look would be greatly appreciated.
So to solve my issue all I had to do was to set the PostSharp 'Processor Architecture' option in the project properties to x64 for the project that includes my aspects.
I'm not exactly sure why but my application builds and runs without issues.
Had the same issue, PostSharp crashing at compile time:
Severity Code Description Project File Line Suppression State
Error An unexpected exception occurred when executing user code: System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
at System.Reflection.RuntimeMethodInfo.FetchNonReturnParameters()
at System.Reflection.RuntimeMethodInfo.GetParameters()
at PostSharp.Patterns.Model.NotifyPropertyChanged.DependencyAnalysis.InpcMemberAnalysis.IsInpcIgnoredProperty(PropertyInfo property)
at PostSharp.Patterns.Model.NotifyPropertyChangedAttribute.<>c.<GetNotifiableProperties>b__48_0(PropertyInfo p)
at System.Linq.Enumerable.WhereArrayIterator`1.MoveNext()
at PostSharp.Patterns.Model.NotifyPropertyChangedAttribute.GetNotifiableProperties(Type type, Boolean excludeExplicitProperties, Boolean& hasExplicitProperties)
at PostSharp.Patterns.Model.NotifyPropertyChangedAttribute.CompileTimeInitialize(Type type, AspectInfo aspectInfo)
at PostSharp.Sdk.AspectWeaver.AspectWeavers.TypeLevelAspectWeaverInstance.^gAHJKdyo.^WnalpwzH()
at PostSharp.Sdk.Utilities.ExceptionHelper.ExecuteUserCode(MessageLocation messageLocation, Action userCode, Type[] acceptableExceptions). Avalon.Dock.Measurements
Solved it by killing the process PostSharp Compile service (something like this) from the task manager.
After using my application successfully in development for a couple of weeks, I shipped it to my client. The application use Ninject to handle dependencies.
When I try to run the application on the client machine, an error occurs:
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.FileNotFoundException
Stack:
at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
at System.Reflection.RuntimeAssembly.GetExportedTypes()
at Ninject.Infrastructure.Language.ExtensionsForAssembly.HasNinjectModules(Assembly assembly)
at Ninject.Modules.AssemblyNameRetriever.AssemblyChecker.GetAssemblyNames(IEnumerable`1 filenames, Predicate`1 filter)
at Ninject.Modules.AssemblyNameRetriever+AssemblyChecker.GetAssemblyNames(System.Collections.Generic.IEnumerable`1<System.String>, System.Predicate`1<System.Reflection.Assembly>)
at Ninject.Modules.AssemblyNameRetriever.GetAssemblyNames(System.Collections.Generic.IEnumerable`1<System.String>, System.Predicate`1<System.Reflection.Assembly>)
at Ninject.Modules.CompiledModuleLoaderPlugin.LoadModules(System.Collections.Generic.IEnumerable`1<System.String>)
at Ninject.Modules.ModuleLoader.LoadModules(System.Collections.Generic.IEnumerable`1<System.String>)
at Ninject.KernelBase..ctor(Ninject.Components.IComponentContainer, Ninject.INinjectSettings, Ninject.Modules.INinjectModule[])
at MyApplication.Main.Application_Start()
at MyApplication.Main..ctor()
at MyApplication.Program.Main()
What can cause this exception?
Framework 4.0
NInject 3.0.0.0
Thank you.
I would guess that the IoC container (Ninject) is looking for an assembly to reflect upon that cannot be found. Perhaps an assembly is not being packaged propely with your deployment? That could also explain why it works on your development machine but not on the client machine.
I'm working on a .net WinForms application that embeds the Flash ActiveX component. When the application is compiled on my computer, Flash loads fine. When the application is compiled on our build server, it throws the following exception when run:
System.Runtime.InteropServices.COMException (0x80040154): Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
at System.Windows.Forms.UnsafeNativeMethods.CoCreateInstance(Guid& clsid, Object punkOuter, Int32 context, Guid& iid)
at System.Windows.Forms.AxHost.CreateWithoutLicense(Guid clsid)
at System.Windows.Forms.AxHost.CreateWithLicense(String license, Guid clsid)
at System.Windows.Forms.AxHost.CreateInstanceCore(Guid clsid)
at System.Windows.Forms.AxHost.CreateInstance()
at System.Windows.Forms.AxHost.GetOcxCreate()
at System.Windows.Forms.AxHost.TransitionUpTo(Int32 state)
at System.Windows.Forms.AxHost.CreateHandle()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.AxHost.EndInit()
[Internal Stack Trace]
I want to see what clsid my application is trying to load. Is there such a thing as ActiveX-Spy?
Edit: Clarity.
You might want to fire up a tool like procmon (sysinternals.com) and capture what registry entries are being read at the time that the error occurs. Filter on RegOpenKey operations (Operation is RegOpenKey) and look for unsuccessful results (Result is not SUCCESS). It's a bit tedious but by comparing reg traces between the 2 machines it should point you to the answer.
What I have used for spying on legacy c++ dlls is ProcMon. You can Spy on all the dlls activity (registry,filesystem, network, etc.)
I am learning how to use NUnit. I have my main project in it's solution, and created a separate project in that same solution which will hold my unit tests, with it's own namespace. From that project I add a reference to the main project and add a
using MainProjectNamespace;
to the top of it.
When I go to NUnit, any tests I have that don't reference the main project work. These are tests I setup just to get used to NUnit, and are pretty much useless. When NUnit runs the real tests the test throws this exception:
TestLibrary.Test.TestMainProject:
System.IO.FileNotFoundException :
Could not load file or assembly
'WpfApplication2, Version = 1.0.0.0,
Culture=neutral, PublicKeyToken=null'
or one of its dependencies. The
system cannot find the specified file.
Why am I getting this exception?
EDIT:
Now when I try to load the assembly into NUnit, it won't even load (so I can't even get a chance to run the tests)
This is the Exception that come sup, and the stack trace:
System.IO.DirectoryNotFoundException: Could not find a part of the path 'LONG PATH HERE I DON'T WANT TO TYPE'
System.IO.DirectoryNotFoundException...
Server stack trace:
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.Directory.SetCurrentDirectory(String path)
at NUnit.Core.DirectorySwapper..ctor(String directoryName)
at NUnit.Core.Builders.TestAssemblyBuilder.Load(String path)
at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, Boolean autoSuites)
at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, String testName, Boolean autoSuites)
at NUnit.Core.TestSuiteBuilder.Build(TestPackage package)
at NUnit.Core.SimpleTestRunner.Load(TestPackage package)
at NUnit.Core.ProxyTestRunner.Load(TestPackage package)
at NUnit.Core.ProxyTestRunner.Load(TestPackage package)
at NUnit.Core.RemoteTestRunner.Load(TestPackage package)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at NUnit.Core.TestRunner.Load(TestPackage package)
at NUnit.Util.TestDomain.Load(TestPackage package)
at NUnit.Util.TestLoader.LoadTest(String testName)
EDIT2:
The above path clearly IS in my hard drive
EDIT3:
I just switched from Debug to Release, on NUnit, and loaded the dll from the release folder of TestingLibrary... And it loaded! 1 of the 3 namespace-specific tests worked. Getting somewhere, I am.
EDIT4:
Welllllllll... I can actually run the tests now, but I am back to the original error. IT is not finding the assembly for the main project
The compiler removes all unused references, and doesn't deploy the dll unnecessarily. A using (by itself) does not count as a use. Either mark the dll for deployment via the "Copy to output directory" setting, or add some code that really uses types declared in the dll.
Did you rename the name of the output assembly OR namespace in the source project?
Looks like your source file is "WPFApplication1" & I am speculating that you might have changed the output type from dll to exe?
I had the same problem and RKitsons answer helped me.
Basically I copied all the dll's that my project depends on as well as the nunit.framework.dll into the same directory...obj/debug/ THis is one way of doing it.
The elegant method is to change the project configuration , in Visual Studio, under the Build tab to release mode and if the project is setup correctly should copy all the dependent dll's into an appropriate "out" or "release" directory.
It looks like one of the assemblies you are referencing in your app has dependencies on another assembly which is not in your bin folder.