Home Dashboard Directory Help
Search

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


Status: 

Closed
 as Duplicate Help for as Duplicate


1
0
Sign in
to vote
Type: Bug
ID: 788335
Opened: 5/21/2013 1:56:38 PM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description


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.
Details
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")]
IMyServiceContractInterface

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

<system.xml.serialization>
    <xmlSerializer useLegacySerializerGeneration="true" />
</system.xml.serialization>

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. http://msdn.microsoft.com/en-US/library/bk3w6240(v=VS.80).aspx. 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(http://support.microsoft.com)
Sign in to post a workaround.