Freigeben über


BizTalk Unit Testing issue from .NET 4.0 and above

PipelineObjects.dll is a pipeline tool provided with BizTalk SDK to perform BizTalk Unit testing. The first thing that we do when using this utility is to create an instance of pipelinefactory and create pipeline using the below code.
I used this below code to test my biztalk 2006 applications and everything worked fine as expected.

PipelineFactory pf = new PipelineFactory();
IPipeline pipeline = pf.CreatePipelineFromType(typeof(pipelineClass));

But when I used the same code in BizTalk 2010 environment I encountered the error

“Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.BizTalk.Component.Interop.IComponentTypeInfo'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{CF0480A5-F484-415b-AEC6-0AB44855758B}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE))”

However the pipeline that I used in worked as expected in biztalk runtime.

Later found that, from .net 4.0 onwards there has been a change in how .net calls the com component and now on, .net supports calling of com components using an entry in config file. This is the same entry that Biztalk exe(Btsntsvc.exe) uses to executes com components.

<configuration>
 <startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" />
    </startup>
</configuration>
After adding the above config file for my unit testing application, my application ran successfully.

Happy Biztalking

Written by
Shashidharan Krishnan

Reviewed by
Jainath V R

Microsoft India GTSC

Comments