HttpRemotingHandlerFactory System.MissingFieldException - c#

I have an application hosted in iis. Very occasionally (every month or two) the following exception is thrown:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for "System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory" threw an exception. ---> System.MissingFieldException: Field not found: ?.s_webServicesFactoryType.
The application is set to automatically recycle every day and it seems sometimes after a recycle this exception is thrown repeatedly until the next recycle.
The only hit I can find on google is http://mcfunley.com/135/bizarro-typeinitializationexception-in-systemruntimeremoting, which describes the exact same problem but there doesn't seem to be a solution posted.
Has anyone experienced this before?
Thanks in advance.

Related

Running mono on Windows with Winforms applications exits immediately

I've got mono 3.2.3 installed. When I try to run a Winforms application - even one as simple as the default template when creating a new project - mono exits immediately with exit code 1 without doing anything, and with no output. Console Applications work fine.
This is from trying to run it in Cygwin:
By changing the project's Output Type to Console Application I got error messages in the console.
Unhandled Exception:
System.TypeInitializationException: An exception was thrown by the type initializer for System.Windows.Forms.WindowsFormsSynchronizationContext ---> System.TypeInitializationException: An exception was thrown by the type initializer for System.Windows.Forms.ThemeEngine ---> System.TypeInitializationException: An exception was thrown by the type initializer for System.Windows.Forms.ThemeWin32Classic ---> System.TypeInitializationException: An exception was thrown by the type initializer for System.Drawing.KnownColors ---> System.TypeInitializationException: An exception was thrown by the type initializer for System.Drawing.GDIPlus ---> System.DllNotFoundException: /tmp/install/lib/libgdiplus.so
Googling that lead me to a page in mono's bug tracker: https://bugzilla.xamarin.com/show_bug.cgi?id=8309
Apparently, this bug was already fixed a year ago, but only merged into mono 3.4.0. The workaround is to edit the file
$MONO/etc/mono/config
and remove the two offending lines:
<dllmap dll="gdiplus" target="/tmp/install/lib/libgdiplus.so" />
<dllmap dll="gdiplus.dll" target="/tmp/install/lib/libgdiplus.so" />
This fixed the issue.

matlab dll throws exception when used in C# .NET

I'm working on a project that requires curve-fitting. To get best results I opted to use MATLAB toolkit. I created a dll of this code and tried to use it in C# .NET framework. The dll works successfully on one system but not on any other system.
I get the following exception:
Unhandled Exception: System.TypeInitializationException: The type initializer fo
r 'curve.cfit' threw an exception. ---> System.TypeInitializationException: The
type initializer for 'MathWorks.MATLAB.NET.Utility.MWMCR' threw an exception. --
-> System.TypeInitializationException: The type initializer for 'MathWorks.MATLA
B.NET.Arrays.MWArray' threw an exception. ---> System.DllNotFoundException: Unab
le to load DLL 'mclmcrrt7_17.dll': The specified module could not be found. (Exc
eption from HRESULT: 0x8007007E)
at MathWorks.MATLAB.NET.Arrays.MWArray.mclmcrInitialize2(Int32 primaryMode)
at MathWorks.MATLAB.NET.Arrays.MWArray..cctor()
--- End of inner exception stack trace ---
at MathWorks.MATLAB.NET.Utility.MWMCR..cctor()
--- End of inner exception stack trace ---
at curve.cfit..cctor()
--- End of inner exception stack trace ---
at curve.cfit..ctor()
I wanted to know why this is happening and how I can solve this issue? I need to deploy my project on multiple machines. What should I do?
thank you in advance :)
The error tells you that the program could not find mclmcrrt7_17.dll. This is part of the MATLAB compiler runtime that you need to deploy on each target machine. It looks like you have not deployed the MATLAB compiler runtime.
The runtime redistributable file is available here: http://www.mathworks.co.uk/products/compiler/mcr/index.html

debugger does not stop on error

I'm working on Asp.net MVC4 project using Visual Studio 2012.
When there's an error during debugging, it used to stop on the error.
But suddenly, the debugger does not stop and just spit out the error information webpage like below.
Server Error in '/' Application.
The given key was not present in the dictionary.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.Collections.Generic.KeyNotFoundException:
The given key was not present in the dictionary.
Source Error: ...
Stack Trace: ...
How can I set the debugger to stop on the error?
I had the same problem, even my debugging options are the same as #John Koerner.
I found that not all exception types are enabled to break the solution by default. You can choose which are enabled from the Exception Setting window.
VS2015: Debug -> Windows -> Exception Settings.
VS2012: Debug -> Exceptions more details
I enabled the whole CLR Exceptions set.
Make sure the exception assistant is enabled:

"An unhandled exception of type 'System.ExecutionEngineException' occurred in Unknown Module."

I'm writing an app in metro (XAML + C#) and I have fatal error which source I can't find:
System.ExecutionEngineException was unhandled
Message: An unhandled exception of type 'System.ExecutionEngineException' occurred in Unknown Module.
It came when I push the button and open new frame.
Weird is this that when I run this app on my laptop there is no any error but when i run it on another computer it have this fatal error when i going from one site to another.
Can someone help me? Anyone have some idea what can be wrong?

Error: Compilation Lock when running unit tests

We have over 1000 unit tests. A while ago 18 of them started to fail when they were run together with the other tests. These tests run a windows workflow.
If they are run alone they pass.
The error appears to be that it cannot find the connection string.
It cannot find the connection string because it does not know which config file to look in.
It does not know which config file to look in because it cannot find the application context
And it cannot find the application context due to a compilation lock.
Anybody have any idea what could be wrong, and how to fix this? The error I am getting is:
Message: Exception message: The
supplied connection string is not
valid, because it contains
insufficient mapping or metadata
information. Parameter name:
connectionString Inner exception :
System.InvalidOperationException:
Unable to determine application
context. The ASP.NET application path
could not be resolved. --->
System.Reflection.TargetInvocationException:
Exception has been thrown by the
target of an invocation. --->
System.Web.HttpException: The type
initializer for
'System.Web.Compilation.CompilationLock'
threw an exception. --->
System.TypeInitializationException:
The type initializer for
'System.Web.Compilation.CompilationLock'
threw an exception. --->
System.NullReferenceException: Object
reference not set to an instance of an
object. at
System.Web.Compilation.CompilationLock..cctor()
--- End of inner exception stack trace --- at System.Web.Compilation.CompilationLock.GetLock(Boolean&
gotLock) at
System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled()
Thanks
Shiraz
Since you mention that your tests run a WF workflow, I would guess that a previous test run has one or more workflow instances that still run on a thread somewhere, thus locking the compiler because the assemblies are still loaded in a process somewhere.
Can you open Task Manager and investigate whether there's a running process that still uses the workflow somewhere? If so, kill it and see if you can't compile.

Categories

Resources