Serialization hangs or throws an OutOfMemoryException with static delegate and ISerializable on 3.5 SP1 - by Fabian Schmied

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


23
0
Sign in
to vote
ID 361615 Comments
Status Closed Workarounds
Type Bug Repros 11
Opened 8/13/2008 4:40:17 AM
Access Restriction Public

Description

When a generic class implements ISerializable and has a static delegate member that makes use of the generic type arguments, binary deserialization hangs (on a 32-bit system with Windows Server 2003) or throws an OutOfMemoryException (on a 64-bit system with Windows Server 2008).

This error occurs with .NET 3.5 SP1 and did not occur with .NET 3.5 without SP1.
Sign in to post a comment.
Posted by Mike Atlas on 5/17/2010 at 12:49 PM
I came across this as well. Linking up.

http://stackoverflow.com/questions/2823205/outofmemoryerror-calling-xmlserializer-deserialize-not-related-to-xml-size/2851905#2851905
Posted by Microsoft on 10/13/2008 at 11:28 AM
Just posting a follow-up. For those interested in the hotfix for this issue, Doug Stewart, who has been instrumental in helping us get these fixes built and out to the community, has a blog post with details on how to obtain the fix for this issue (and a couple of others). See http://blogs.msdn.com/dougste/archive/2008/10/07/what-s-in-microsoft-net-framework-3-5-sp1.aspx for more details.

Thanks again to Fabian and the others who reported and provided details about this issue. Your contributions to both the community and our products are greatly valued.

Regards,
Jon
Posted by Fabian Schmied on 9/26/2008 at 12:35 AM
Jon,

Thank you for handling and fixing this bug as well.

Regards,
Fabian
Posted by Microsoft on 9/25/2008 at 11:42 AM
Fabien,

Thank you for your patience. We're in the process of testing a hotfix for this issue. I expect it will be available within a week or so. I'll keep you posted on the status and give you the KB (knowledge base) article number and how you, and other customers, can acquire the hotfix once it's available.

Additionally we intend to include this fix in an upcoming servicing release, a roll-up of sorts, which will be released in synch with 3.5SP1 via Windows Update. I.e. when 3.5SP1 starts getting pushed out broadly, so will this fix. We’re still working out the exact timeframe for this release but our hope is before the end of the year.

Thanks again for reporting this issue. We greatly appreciate your commitment to helping us improve the quality of our products.

Kind Regards,
Jon
Posted by Microsoft on 9/24/2008 at 4:34 PM
Fabien,

Thank you for your patience. We're in the process of testing a hotfix for this issue. I expect it will be available within a week or so. I'll keep you posted on the status and give you the KB (knowledge base) article number and how you, and other customers, can acquire the hotfix once it's available.

Additionally we intend to include this fix in an upcoming servicing release, a roll-up of sorts, which will be released in synch with 3.5SP1 via Windows Update. I.e. when 3.5SP1 starts getting pushed out broadly, so will this fix. We’re still working out the exact timeframe for this release but our hope is before the end of the year.

Thanks again for reporting this issue. We greatly appreciate your commitment to helping us improve the quality of our products.

Kind Regards,
Jon
Posted by Microsoft on 9/23/2008 at 9:17 PM
Fabien,

Thank you for your patience. We're in the process of testing a hotfix for this issue. I expect it will be available within a week or so. I'll keep you posted on the status and give you the KB (knowledge base) article number and how you, and other customers, can acquire the hotfix once it's available.

Additionally we intend to include this fix in an upcoming servicing release, a roll-up of sorts, which will be released in synch with 3.5SP1 via Windows Update. I.e. when 3.5SP1 starts getting pushed out broadly, so will this fix. We’re still working out the exact timeframe for this release but our hope is before the end of the year.

Thanks again for reporting this issue. We greatly appreciate your commitment to helping us improve the quality of our products.

Kind Regards,
Jon
Posted by Fabian Schmied on 9/15/2008 at 4:17 AM
Thanks for fixing that bug! Where, when, and how will the fix be released?

(Due to the kind of the bug -- and due to the fact that there are a lot of other bugs introduced with 3.5 SP1 -- an SP 1 refresh/auto update seems appropriate, IMO)
Posted by Microsoft on 9/10/2008 at 3:13 PM
A fix for this issue has been created and tested, and will be released in the near future.
Posted by Pelle Plutt on 9/9/2008 at 2:34 AM
Duplicate of https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=356498
Posted by Microsoft on 8/21/2008 at 6:58 PM
Fabian,

I wanted to let you know we're also making progress on this issue. In fact, the same team is looking into both of your issues. :) For this issue as well, I'll keep you up-to-date as the investigation proceeds.

Thanks again for reporting these and please let me know if there's anything else I can do at the moment.

Regards,
Jon
Posted by josve on 8/21/2008 at 2:01 AM
Note that the C# compiler sometimes automatically adds static fields to a class during optimization; for example the following version of the SerializationTest<T> class will also fail while not containing any user added static fields.

    [Serializable]
    class SerializationTester<T> : ISerializable
    {
        public void Test()
        {
            List<string> test = new List<string>();
            test.FindAll(delegate(string s) { return string.IsNullOrEmpty(s); });
        }

        public SerializationTester()
        {
        }
        protected SerializationTester(SerializationInfo info, StreamingContext context)
        {
        }
        public void GetObjectData(SerializationInfo info, StreamingContext context)
        {
        }
    }
Posted by Stefan Wenig on 8/18/2008 at 5:39 AM
a few blogs discussing this bug and how it could be handled:
http://feeds.feedburner.com/~r/AyendeRahien/~3/365603718/Waiting-for-the-Service-Pack-I-dont-think-so.aspx
http://www.re-motion.org/blogs/team/archive/2008/08/14/.net-3.5-sp1-broke-some-scenarios-for-mixins.aspx
Posted by Microsoft on 8/16/2008 at 9:42 AM
Fabian,

Thank you for raising this issue, as well. We certainly appreciate your taking the time to provide simplified repros. I wanted to let you know this bug is also being investigated by the CLR team and we'll provide you with status as the investigation progresses.

Thanks again,
Jon Langdon
Program Manager
Common Language Runtime
Posted by Microsoft on 8/13/2008 at 7:53 PM
We were able to reproduce the issue you are seeing. We are escalating this bug to the product unit who works on that specific feature area. The product team will review this issue and make a decision on whether they will fix it or not for the next release