How to fix "Activated Event Time Duration Thread Exception" in C#? - c#

ERROR:
Activated Event Time Duration Thread
Exception: Exception thrown: 'System.TypeInitializationException' in EntityFramework.dll ("The type initializer for 'System.Data.Entity.Internal.AppConfig' threw an exception."). Exception thrown: 'System.TypeInitializationException' in EntityFramework.dll ("The type initializer for 'System.Data.Entity.Internal.AppConfig' threw an exception.")

The steps s for solving my problem:
1.I removed EntityFramework 6.2.0 and installed it again.
2.I deleted ModelData Base and added to project it again.
With this solution, my problem solved.

Related

Unloading Child AppDomain kills Parent

I am trying to figure out AppDomains.
I use following code to run the current application once more in a new child AppDomain with an argument:
AppDomain domain = AppDomain.CreateDomain("NewAppDomain", null);
domain.ExecuteAssemblyByName(currentAssembly.FullName, "argument");
It works fine, however, when I try to unload it via AppDomain.Unload(domain);, it also kills Parent it was called from.
In the debug output I can see following errors:
Exception thrown: 'System.Threading.ThreadAbortException' in mscorlib.dll
Exception thrown: 'System.Threading.ThreadAbortException' in mscorlib.dll
Exception thrown: 'System.Threading.ThreadAbortException' in TestAppDomain.exe
Exception thrown: 'System.Threading.ThreadAbortException' in System.Windows.Forms.dll
Exception thrown: 'System.AppDomainUnloadedException' in TestAppDomain.exe
I am not sure what is the issue here, how can I correctly unload such child AppDomain without killing Parent?
Main thread was not stopped completely before I tried to unload the AppDomain.
Stopping it correctly fixed the error.

An unhandled exception of type 'System.TypeInitializationException' occurred in Emgu.CV.dll

I'm doing Web camera App in Visual Studio 2012. When I build my program, I got this type of error.An unhandled exception of type System.TypeInitializationException occurred in Emgu.CV.dll
Additional information: The type initializer for Emgu.CV.CvInvoke threw an exception.
Error Log:
A first chance exception of type 'System.ArgumentException' occurred in mscorlib.dll
A first chance exception of type 'System.DllNotFoundException' occurred in Emgu.CV.dll
A first chance exception of type 'System.TypeInitializationException' occurred in Emgu.CV.dll
An unhandled exception of type 'System.TypeInitializationException' occurred in Emgu.CV.dll
Additional information: The type initializer for 'Emgu.CV.CvInvoke' threw an exception.
The thread '<No Name>' (0x19d4) has exited with code 0 (0x0).
The program '[8784] CameraApp.vshost.exe: Program Trace' has exited with code 0 (0x0).
The program '[8784] CameraApp.vshost.exe: Managed (v4.0.30319)' has exited with code 0 (0x0).
Not sure what may be causing them, but you could set the debugger to stop at the very first first chance exception so you atleast get an idea of what may be causing the problem.
To do this go to Debug/Exceptions...
On the exceptions dialog box, click the Throw check box for the Common Language Runtime Exceptions this cause the debugger to stop immediatelly on the first change exception....and give you an idea of what is going on....
I hope this helps...
I get this error when I run my app in a 64 bit OS. If your OS is 64 bit, that is the culprit.

Emgu.CV dont work on windows 7 x64

I have program that works fine in my windows 8 x64. But when i try to run it in my laptop with windows 7 x64 i have some problems.
errors:
A first chance exception of type 'System.ArgumentException' occurred in mscorlib.dll
Additional information: URI formats are not supported.
A first chance exception of type 'System.BadImageFormatException' occurred in Emgu.CV.dll
Additional information: You tried to load the wrong format. (Excluded from the HRESULT: 0x8007000B)
A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
Additional information: Target call threw an exception.
A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll
Additional information: Target call threw an exception.
'InzV2.vshost.exe' (CLR v4.0.30319: InzV2.vshost.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xaml.resources\v4.0_4.0.0.0_pl_b77a5c561934e089\System.Xaml.resources.dll'. Module was built without symbols.
A first chance exception of type 'System.Xaml.XamlObjectWriterException' occurred in System.Xaml.dll
Additional information:Calling the constructor for the type of „InzV2.MainWindow” compatible with specific binding constraints caused an exception.
A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll
Additional information: Calling the constructor for the type of „InzV2.MainWindow” compatible with specific binding constraints caused an exception., line number 3, position 9.
An unhandled exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll
Additional information: Calling the constructor for the type of „InzV2.MainWindow” compatible with specific binding constraints caused an exception., line number 3, position 9.
This errror looks like this:
I'm using Emgu.CV lib from Nuget called: myEmguCV.Net.
even if i try just crete new project with only:
BackgroundSubtractorMOG2 pMog11 = new BackgroundSubtractorMOG2(0, 80, false);
i have error..
This error occurs when unmanaged assembly is compiled for different platform than your .NET code is currently being compilled to.
For example if the unmanaged dll are in x86 architecture and you are trying to compile your code to x64 .NET runtime, you will get this type of error.
In the image you have provided it seems that you are trying to compile the code to x86 architecture and your EmguCV unmanaged .dlls are probably x64 based.
So go to
Project -> Properties -> Build -> tick the platform that matches the platform for which an unmanaged dll is compiled (x86, x64) (probably in your case it should be x64).

A first chance exception of type 'System.IndexOutOfRangeException' occurred in mscorlib.dll

I have a WCF project (.NET 4.5) and when I call a long running function on it, I'm getting this error:
A first chance exception of type 'System.IndexOutOfRangeException' occurred in mscorlib.dll
in the output window, but the thing is when I debug the project, there are no exceptions thrown in the project and the project keeps running/debugging as if no error happened. I thought that if there was an exception in my code, it should break and show the stack trace, but in this case no errors and keeps running. I'm seeing this information like a lot. It fills the output window and keeps going/adding
Do anyone know what this error means? Why am I not getting unhandled exception thrown error if this is true?

DllNotFoundException -- VisStudio 2008, C#

This just started happening with an application that has been working:
"A first chance exception of type 'System.DllNotFoundException' occurred in PresentationCore.dll
A first chance exception of type '.ModuleLoadException' occurred in PresentationCore.dll
A first chance exception of type 'System.TypeInitializationException' occurred in mscorlib.dll
An unhandled exception of type 'System.TypeInitializationException' occurred in mscorlib.dll"
How do I figure out which dll is missing?
TIA for any hints...
You can use fuslogvw.exe to check for missing assembly dependencies, or Depends.exe for native dependencies.

Categories