Search code examples
oraclebiztalkbiztalk-2020

BizTalk 2020 Oracle Error: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information


Getting this error:

Error Description: System.Reflection.ReflectionTypeLoadException: 
Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

Server stack trace: 
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.RuntimeModule.GetTypes()
   at System.Reflection.Assembly.GetTypes()
   at Microsoft.Adapters.OracleDB.OracleDBConnectionFactory.LoadUdtAssemblies(String UserAssembliesLoadPath)
   at Microsoft.Adapters.OracleDB.OracleDBConnection.Microsoft.ServiceModel.Channels.Common.IConnection.BuildHandler[TConnectionHandler](MetadataLookup metadataDictionary)
   at Microsoft.ServiceModel.Channels.Common.Design.ConnectionPool.GetConnectionHandler[TConnectionHandler](Guid clientId, TimeSpan timeout, MetadataLookup metadataLookup, String& connectionId)
   at Microsoft.ServiceModel.Channels.Common.Channels.AdapterRequestChannel.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open()

In the stack trace above, we see this program: Microsoft.Adapters.OracleDB.OracleDBConnectionFactory.LoadUdtAssemblies so I believe it gets the error trying to load the .DLL for the UDTs (User Defined Types).

But here is the full situation. This app works fine on BizTalk 2016. I ran GacUtil to put the exact same DLL into the GAC on BizTalk 2020.

From looking at the schemas in the application, the UDTs are in the request, not the response. The BizTalk orchestration is sending multiple rows of data to be inserted or updated.

The send port has the correct .dll name specified in the userAssembliesLoadPath property: C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Oracle_ZEMA_XXCMI_PowerDataUserTypes_v0101\v4.0_0.0.0.0__81552c10a3b36c51\Oracle_ZEMA_XXCMI_PowerDataUserTypes_v0101.dll

I have also created a separate Host Instance for this particular SendPort. Right now I have it set to be 32 bit, but I have tried 64 bit as well.

We one other app that uses a different UDT .dll file, and it is working fine.

I tried to rebuild the .dll using Visual Studio 2019. I went through "Add Generated Items", "Add Adapter Metadata", and used WCF-OracleDB as the adapter. It generated the schemas, but not the .DLL. So that's a second question.

The error does say to "retrieve the LoaderExceptions property". I spent some time today trying to catch a better exception and find that property, but no success. Our catch for System.Exception is firing, and we have code that does this:

 "ExceptionType=" + System.Convert.ToString(exException.GetType()) +

which shows this in our trace:

ExceptionType=Microsoft.XLANGs.Core.XlangSoapException

I added two new catch blocks to my scope shape (above the System.Exception), but neither caught anything, only the System.Exception.

  1. System.Reflection.ReflectionTypeLoadException
  2. Fault from the two-way Send Port Soap 1.1 (didn't try 1.2 yet)

I have checked the InnerExeption and it is null. The exception type is: Microsoft.XLANGs.Core.XlangSoapException. I also tried this:

exBase = exException.GetBaseException(); 
tempExceptionText = tempExceptionText + 
        "\r\nBase ExceptionType=" +  
            System.Convert.ToString(exBase.GetType()); 

But that also shows: Base ExceptionType=Microsoft.XLANGs.Core.XlangSoapException


Solution

  • It turns out that when you generate the UDT (using the Add Generated Items tool in Visual Studio), the .dll generated apparently gets a reference to a specific version of the OracleAccess.dll (or similar .dll). Thus it is not good for different version of Oracle, and it must be regenerated on a server with the desired release of Oracle. (We had to do a Microsoft support ticket to get to this conclusion.)