.NET Questions and Solutions

As a software engineer, I focus on .NET, especially asp.net, C#, WCF and so on, and I am also very interested in Search Engine Optimization.

Entries Tagged ‘application domains’

FIX: The System.EnterpriseServices.TransactionProxyException exception cannot be caught from other application domains when it is triggered during a transaction completion

Symptoms
When a System.EnterpriseServices.TransactionProxyException exception is triggered during a transaction completion, it cannot be caught from other application domains. Instead, you receive a System.Runtime.Serialization.SerializationException exception that resembles the following:

Unhandled Exception: System.Runtime.Serialization.SerializationException: Type ‘System.EnterpriseServices.TransactionProxyException’ in Assembly ‘System.EnterpriseServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ is not marked as serializable.
Resolution
This problem occurs because the TransactionProxyException exception is not serialized, and then cannot be caught from another application domain.

BUG: Various errors may occur when you try to call managed code from unmanaged code in Visual C++ .NET 2003

Symptoms
You have a Microsoft Visual C++ .NET 2003 application that uses multiple application domains. When you try to call managed code from unmanaged code in a DLL that has already been loaded in another application domain, you may receive the following error message:

An unhandled exception of type ‘System.NullReferenceException’ occurred in mscorlib.dll
Additional information: Object reference not set to an instance of an object.Note In some scenarios, you may receive one of the following error messages:

DllNotFoundException

Illegal Instruction
Resolution
You may notice this problem if your application contains unmanaged code and uses multiple application domains.
For example, if you have an application that uses multiple application domains that use a set of DLLs, you can successfully load and use these DLLs in the first application domain. However, when you try to call the managed code in one of these DLLs from unmanaged code in a different (second) application domain, the behavior that is mentioned in the “Symptoms” section of this article occurs. The application does not load the managed code in the second application domain because the code has already been loaded in another application domain that is in the same process.