views:

27

answers:

1

For my application, I need to serialize data to file using XML, so I read Introducing XML Serialization on MSDN. One thing that concerns me is under the Security Considerations for XmlSerializer Applications section it reads:

The XmlSerializer creates C# (.cs) files and compiles them into .dll files in the directory named by the TEMP environment variable; serialization occurs with those DLLs.

A user may have multiple instances of my application running at the same time. My concern is that the 2 different instances will be serializing to different XML files, however, the XmlSerializer class in application instance 2 could over write the DLLs generated by the XmlSerializer class in application instance 1. Should this be a concern, or are temp/unique file names used for these DLL names?

FYI: I need to use XML instead of binary serialization as we need to edit values in the files by hand sometimes.

Thanks

+3  A: 

Should this be a concern, or are temp/unique file names used for these DLL names?

The names are unique, you don't need to worry about that

If your app is going to make extensive use of XML serialization, you might want to pre-generate the serialization assembly using Sgen.exe. This will avoid the overhead of generating it at runtime, and the assembly name will be fixed (YourAssembly.XmlSerializers.dll)

Thomas Levesque