Logging Application Block causes an Invalid Cast Exception on .NET Remoting

Topics: Logging Application Block
Apr 27, 2011 at 12:09 AM
Edited Apr 27, 2011 at 12:11 AM

I am getting an Invalid Cast Exception when using the Logging Application Block on the client.  The server is not using Enterprise Library.

Capturing the SOAP message, it looks like the Correlation Manager is the problem.

Turning off the Logging AB on the client will make the .NET remoting call work.  However, I do not have control over the clients and we want to clients to use Ent Lib Logging anyway because they do much more than just calling this service.  I have control over the server, but it is not using Ent Lib anyway, so there is nothing for me to turn on or off on the server side.

What is the workaround I can do for this?  Our Ent Lib version is 3.1.

<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:clr="http://schemas.microsoft.com/soap/encoding/clr/1.0" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Header>
<h4:__CallContext href="#ref-3" xmlns:h4="http://schemas.microsoft.com/clr/soap/messageProperties" SOAP-ENC:root="1"/>
<a1:LogicalCallContext id="ref-3" xmlns:a1="http://schemas.microsoft.com/clr/ns/System.Runtime.Remoting.Messaging">
<__CorrelationMgrSlotPresent>true</__CorrelationMgrSlotPresent>
<System.Diagnostics.Trace.CorrelationManagerSlot href="#ref-5"/>
<E2ETrace.ActivityID xsi:type="a3:Guid" xmlns:a3="http://schemas.microsoft.com/clr/ns/System">
<_a>755793705</_a>
<_b>-1325</_b>
<_c>18212</_c>
<_d>179</_d>
<_e>83</_e>
<_f>50</_f>
<_g>167</_g>
<_h>73</_h>
<_i>104</_i>
<_j>70</_j>
<_k>125</_k>
</E2ETrace.ActivityID>
</a1:LogicalCallContext>
<a2:Stack id="ref-5" xmlns:a2="http://schemas.microsoft.com/clr/ns/System.Collections">
<_array href="#ref-6"/>
<_size>0</_size>
<_version>0</_version>
</a2:Stack>
<SOAP-ENC:Array id="ref-6" SOAP-ENC:arrayType="xsd:anyType[10]">
</SOAP-ENC:Array>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<i7:GetSubmitterInstallerLocation id="ref-1" xmlns:i7="http://schemas.microsoft.com/clr/nsassem/CODESIGN.Submitter.JobRelay/CODESIGN.Submitter">
</i7:GetSubmitterInstallerLocation>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

 

Note: Turning off Ent Lib Logging AB on my test client gives a working soap message that looks like this.

<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:clr="http://schemas.microsoft.com/soap/encoding/clr/1.0" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Header>
<h4:__CallContext href="#ref-3" xmlns:h4="http://schemas.microsoft.com/clr/soap/messageProperties" SOAP-ENC:root="1"/>
<a1:LogicalCallContext id="ref-3" xmlns:a1="http://schemas.microsoft.com/clr/ns/System.Runtime.Remoting.Messaging">
<E2ETrace.ActivityID xsi:type="a2:Guid" xmlns:a2="http://schemas.microsoft.com/clr/ns/System">
<_a>1297253430</_a>
<_b>27285</_b>
<_c>17611</_c>
<_d>135</_d>
<_e>156</_e>
<_f>9</_f>
<_g>40</_g>
<_h>32</_h>
<_i>14</_i>
<_j>158</_j>
<_k>165</_k>
</E2ETrace.ActivityID>
</a1:LogicalCallContext>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<i5:GetSubmitterInstallerLocation id="ref-1" xmlns:i5="http://schemas.microsoft.com/clr/nsassem/CODESIGN.Submitter.JobRelay/CODESIGN.Submitter">
</i5:GetSubmitterInstallerLocation>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Apr 27, 2011 at 2:54 AM
Edited Apr 27, 2011 at 3:33 AM

Hi,

This is a known issue in Enterprise Library and has been reported in issue tracker. I recommend you to vote for this one.

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

Apr 27, 2011 at 3:30 AM

Is there no workaround published anywhere?  Turning off the logging AB on the client is not an option.  Perhaps there is some way to workaround this on the server, like perhaps intercepting the SOAP message. Its been 4 years since the problem was reported.

Apr 27, 2011 at 8:40 AM

Unfortunately, we can't find a solution for this issue. We'll get back to you once we get an update. Also, you can create a sample repro project and attached it to the issue tracker (link found on my previous post), so Microsoft can look further to the issue.

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

May 4, 2011 at 8:21 AM

Hi,

I highly encouraged you to attach the repro project here so Microsoft can start looking on it.

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com