Large WSDL causing out of memory error when debugging - by RMJ Some Guy Some Where

Status : 

  Duplicate<br /><br />
		This item appears to be a duplicate of another existing Connect or internal item.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 788335 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 5/21/2013 1:56:38 PM
Access Restriction Public


Create very large WSDL file using repeated disco calls to merge into one file.
Run wsdl.exe with merged file as parameter
Generates C# file with 242,000 lines of code.
Create Unit test inside a WCF application to test this code
When loading the DLL assembly that contains this C# code Visual Studio displays an out of memory error.

P.S. This C# code code runs inside a console application.
Sign in to post a comment.
Posted by Mark Plummer on 8/7/2013 at 3:53 PM
Create the XmlSerializers dll explictly using Sgen (as below), and then you must additionally set this on the Service Contract:

[System.Xml.Serialization.XmlSerializerAssemblyAttribute(AssemblyName = "YourAssembly.XmlSerializers")]

In the interim, if you are using .Net 4.5 you can set the App.Config

    <xmlSerializer useLegacySerializerGeneration="true" />

to force it to revert back to using csc.exe which uses less memory
Posted by Microsoft on 5/23/2013 at 7:02 PM
Thanks for your bug report! Earlier in this release cycle we fixed a severe debugger memory growth issue that had the exact same symptoms that you are reporting here. You should be able to test with the next pre-release version of Visual Studio/.Net to see if the issue is resolved.

In the meantime there is also a workaround for this issue by using sgen to generate XmlSerialization assemblies in advance. In addition to this issue, pre-generated serialization assemblies may improve the startup performance of your application and are generally recommended.

The underlying issue is that Xml Serialization in .net 4.5 uses Reflection.Emit technology to incrementally create the serialization assemblies at runtime, however the debugger has very bad memory usage characteristics in this scenario. Past implementations of Xml Serialization used CodeDOM instead which didn't trigger the same debugger behavior. Sgen.exe avoids the issue because .Net won't create serialization assemblies at runtime if they already exist on disk.

Hope this helps,
-Noah Falk
.Net Framework
Posted by Microsoft on 5/22/2013 at 11:29 PM
Thank you for submitting feedback on Visual Studio and .NET Framework. Your issue has been routed to the appropriate VS development team for investigation. We will contact you if we require any additional information.
Posted by Microsoft on 5/22/2013 at 12:52 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(