none
System.Runtime.Serialization.SerializationException RRS feed

  • Question

  • Please redirect if this is not the correct forum.

    I am receiving the following exception during my processing:

    Unable to find assembly 'MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxxxxxxx System.Exception {System.Runtime.Serialization.SerializationException}

    I've attempted to debug this issue without success.  The assembly shows up in the loaded modules while attached to the process using Visual Studio.  I tried using Procmon.exe to determine if there were module load failures, however I am unable to determine where this error is coming from.  The interesting thing is that the method call that is failing is totally unrelated to the assembly load failure above.

    I am using .Net 4.5, however my assemblies also reference .Net 2.0 and .Net 3.5 assemblies.

    Any ideas on how to isolate this issue would be greatly appreciated.


    David Downing... If this answers your question, please Mark as the Answer. If this post is helpful, please vote as helpful.

    Monday, March 17, 2014 7:53 PM

Answers

  • >> Any idea what this call is corrupting to cause my serialization issue

    The logical call context mechanism serializes and deserializes objects in a hashtable. This blog shows it:

    http://www.wintellect.com/blogs/jeffreyr/logical-call-context-flowing-data-across-threads-appdomains-and-processes

    So If it may be the context object will reference the MyAssembly when the call is trying to serialize it but not found the related dll.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, March 20, 2014 9:30 AM
    Moderator
  • I was able to reset the context using CallContext.LogicalSetData(...) and it worked like a charm.


    David Downing... If this answers your question, please Mark as the Answer. If this post is helpful, please vote as helpful.


    Thursday, March 20, 2014 1:38 PM

All replies

  • Hello David,

    I am trying to help look into this issue, and if I understand correctly, you are doing a serialize operation with a type in MyAssembly, is it right?

    >> The interesting thing is that the method call that is failing is totally unrelated to the assembly load failure above.

    Is this method associated with the serialization since I see that the error should be associated with the serialization?

    Could you please provide some codes regarding this issue? And about the MyAssembly, it is a custom assembly?

    Also, please check if you are under this scenario:

    http://stackoverflow.com/questions/13090955/deserialization-exception-unable-to-find-assembly

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, March 18, 2014 2:50 AM
    Moderator
  • My issue doesn't appear to relate to the stackoverflow link you provided.

    I won't be able to provide sample code because it is proprietary security code, however I can try to explain the scenario in more depth.

    I am processing order data from a typed dataset object.  While processing the order data, several security related actions are needed:

    1. Decrypt/Encrypt several fields from the order data.
    2. Generate hash information for several fields for quick look-up.

    We are using a third party cryptography api that we expose using a factory class that exposes an interface to a security object.  The object returned from the factory is used for the operations above.  This basically exposes the security object as a System.Runtime.RemotingProxies._TransparentProxy object.

    When making calls to this proxy security object to perform one of the operations, from within the actual security instance (third party), I get the Serialization Exception.  This security object does not reference or access the 'MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxxxxxxx' assembly and should simply call the security API and return the results to the calling method.

    This morning I tried removing the factory class and changing the security methods to be static, hoping that removing the transparent proxy access would help, however I'm still getting the serialization exception.

    Please let me know if I can provide additional information.

    Thank you


    David Downing... If this answers your question, please Mark as the Answer. If this post is helpful, please vote as helpful.

    Tuesday, March 18, 2014 2:51 PM
  • I thought I would add some additional information; the call stack goes through several levels of static methods.

    I saw another post relating to static variables and serialization exceptions, but in this case the variables are not static but the two levels of calls are static.


    David Downing... If this answers your question, please Mark as the Answer. If this post is helpful, please vote as helpful.

    Tuesday, March 18, 2014 5:24 PM
  • Hi,

    Maybe this scenario will bring the inspiration to you:

    http://stackoverflow.com/questions/3017258/unable-to-find-assembly-c-sharp

    It also not associated with serialization, but it throws a serialization exception.

    >> I am using .Net 4.5, however my assemblies also reference .Net 2.0 and .Net 3.5 assemblies.

    .Net 2.0 and .Net 3.5 assemblies usually work with 32 bit target, while .Net 4.5 usually works with 64 bit target. Do you have a try change the target to X86/X64?

    Wednesday, March 19, 2014 7:42 AM
  • Thank you for the response.  In this case I am migrating our BizTalk Server 2006 projects to BizTalk Server 2013.  The existing projects (BizTalk and C# DAL methods used in orchestrations) currently run in 64-bit mode in our production environment.  All of the referenced .Net 2.0 and .Net 3.5 assemblies run from GAC_MSIL except our security API which we have both 32-bit and 64-bit versions.  Only the 64-bit version is installed.

    When I remove the calls to the security API methods and simply return a valid value, everything works correctly.

    Because these same APIs work in our existing production, and .Net 4.x should be able to call back-level assemblies, I should be able to get it working...

    I'll research your information and post a reply later.


    David Downing... If this answers your question, please Mark as the Answer. If this post is helpful, please vote as helpful.

    Wednesday, March 19, 2014 2:15 PM
  • I decided to add a reference to my security assembly for each class in the call stack.  This allowed me to isolate the exact call that caused the security methods to fail.  As I stepped through all the code further into the call stack, the security APIs were successful until I called the CallContext.LogicalSetData(UserContext.USER_CONTEXT_KEY, context); from the System.Runtime.Remoting.Messaging namespace.

    Any idea what this call is corrupting to cause my serialization issue.  I tried placing an unsafe keyword on the method that makes this call hoping it would isolate it's functionality, but this didn't seem to work.


    David Downing... If this answers your question, please Mark as the Answer. If this post is helpful, please vote as helpful.


    Wednesday, March 19, 2014 5:40 PM
  • >> Any idea what this call is corrupting to cause my serialization issue

    The logical call context mechanism serializes and deserializes objects in a hashtable. This blog shows it:

    http://www.wintellect.com/blogs/jeffreyr/logical-call-context-flowing-data-across-threads-appdomains-and-processes

    So If it may be the context object will reference the MyAssembly when the call is trying to serialize it but not found the related dll.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, March 20, 2014 9:30 AM
    Moderator
  • I was able to reset the context using CallContext.LogicalSetData(...) and it worked like a charm.


    David Downing... If this answers your question, please Mark as the Answer. If this post is helpful, please vote as helpful.


    Thursday, March 20, 2014 1:38 PM