hungdluit / flowlib

Automatically exported from code.google.com/p/flowlib
0 stars 0 forks source link

XmlSerializer bug occurs when trying to save DownloadManager while windows preparing to shutdown #41

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Try to use FileOperation.SaveObject when windows start to shutdown

What is the expected output? What do you see instead?
It should work. XmlSerializer fails when trying to create new instance.

What version of the product are you using? ~~(Do not write latest)~~
SVN r522

On what operating system?
Windows XP, Windows Vista, Windows 7

Please provide any additional information below.
This is not FlowLib bug, it is internal NET Framework bug. It occurs 
because XmlSerializer trying to create new assembly instead getting it from 
cache. This bug can be avoided by using next fix:

FileOperation.cs Line 33 should be:
XmlSerializer s = new XmlSerializer(obj.GetType());
instead of
XmlSerializer s = new XmlSerializer(obj.GetType(), new XmlRootAttribute());

At this case XmlSerializer will take generated assembly from cache.
Of course line 44 should be fixed too.

You can find addition information here:
http://social.msdn.microsoft.com/Forums/ru-
RU/netfxremoting/thread/6b7f1635-6f01-49e1-9929-7652e2d084be

Original issue reported on code.google.com by hackw...@gmail.com on 10 Jul 2009 at 8:05

GoogleCodeExporter commented 8 years ago
Fix in rev 523.

A memory leak was also fixed (
http://blogs.msdn.com/tess/archive/2006/02/15/net-memory-leak-xmlserializing-you
r-way-to-a-memory-leak.aspx
)

Thanks :)

Original comment by blomman84 on 12 Jul 2009 at 4:54