Bug 8368 - Compiling generated serializer fails silently
Summary: Compiling generated serializer fails silently
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.XML ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: marcos.henrich
Depends on:
Reported: 2012-11-13 09:17 UTC by Taras Roshko
Modified: 2014-08-26 06:12 UTC (History)
5 users (show)

Is this bug a regression?: ---
Last known good build:

Minimal code sample to demonstrate compiling custom serializer bug (1.57 KB, text/plain)
2012-11-13 09:17 UTC, Taras Roshko

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Taras Roshko 2012-11-13 09:17:14 UTC
Created attachment 2912 [details]
Minimal code sample to demonstrate compiling custom serializer bug

Serializing same type using XmlSerializer leads to silent internal crash after N serializations (During compilation of generated serializer)

Test application was run on [Windows 8 .NET] and [Ubuntu 10.04 LTS Mono JIT compiler version 3.0.1 master/62bf3c7]

Steps to reproduce : 

1) Works as expected

export MONO_XMLSERIALIZER_THS=no #never compile custom serializer
mono XmlDebugApp.exe 1 #run app and tell to do 1 serialization
>>Serializing object XmlDebugApp.Foo 1 times... 
>>Serialized object XmlDebugApp.Foo 1 times

2) Fails

export MONO_XMLSERIALIZER_THS=0 #compile custom serializer before first serialization
mono XmlDebugApp.exe 1 #run app and tell to do 1 serialization
>>Serializing object XmlDebugApp.Foo 1 times... 
>>Error while compiling generated serializer
>>(0,0) : error CS1703: An assembly with the same identity `mscorlib, Version=, Culture=neutral, >>PublicKeyToken=b77a5c561934e089' has already been imported. Consider removing one of the references
>>(0,0) : error : mscorlib.dll (Location of the symbol related to previous error)
>>(0,0) : error : /opt/mono/lib/mono/4.5/mscorlib.dll (Location of the symbol related to previous error)
>>Serialized object XmlDebugApp.Foo 1 times

As you can see, application exited normally even after some internal error in mono.
Attached file contains source code for XmlDebugApp.

Problem is caused by field Data in type Foo. (If you change property type from object to string, there will be no error)
Comment 1 Zoltan Varga 2012-11-13 18:46:17 UTC
-> sys.xml.
Comment 2 marcos.henrich 2014-08-26 04:13:25 UTC
Hi Taras.

Thank you for the detailed bug report.

This issue is no longer reproducible, the serialization generated code for the example provided is now compiled without any errors.
Comment 3 Till Lorentzen 2014-08-26 04:42:30 UTC
Hi Marcos,

could you please add the information which mono version fixes this issue?

Thanks a lot!
Comment 4 marcos.henrich 2014-08-26 06:11:08 UTC
Hi Till,

The issue is present in Mono 3.6.
But this is no longer reproducible in the master branch and mono-3.8.0-branch.
Mono 3.8 will no longer have this issue.
Comment 5 Till Lorentzen 2014-08-26 06:12:54 UTC
Thanks a lot!