By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,591 Members | 650 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,591 IT Pros & Developers. It's quick & easy.

Avoiding dynamic generation (+compilation) of XML-Serialization cl

P: n/a
We are building a suite of programs consisting of both winforms applications
and
office addins.

We would like to pre-generate the xml-serialization classes and add it to
our project to
avoid the overhead at startup and thus enhance the performance of our
applications.

The programs are coded in c# under .net 1.1.

The programs use web-services to communication with a server.

We are experincing a rather slow startup of both the winforms applications,
but also the officeproducts (Excel, Word, etc.).

We have isolated the startup overhead to the .net runtime code generation
and compilation of
Microsoft.Xml.Serialization.GeneratedAssembly.

We have tried to solve the problem by
1) Adding
<system.diagnostics>
<switches>
<add name="XmlSerialization.Compilation" value="4" />
</switches>
</system.diagnostics>
to the application config file.
(This will leave the generated and compiled serialization files in the
%TEMP% directory)
2) Starting the application (to get the files generated)
3) Getting the generated .cs file (from the %TEMP% directory)
4) Adding the .cs file with the
System.Xml.Serialization.XmlSerializationWriter class to the project
5) Rebuilding the application.

Unfortunately it seems like this have no effect.
Monitoring the modified application shows that it still generates the .cs
file (current size > 1MB), compiles
it and loads the resulting dll.

Are we missing something? Should we modify the generated code in any way
before including it in the project.
(We are aware that .net 2.0 and the sgen.exe tool might help, but currently
we are stuck with .net 1.1)

Thank you in advance

Mar 22 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi tqvist,

Welcome to the MSDN newsgroup.

As for the Xml serialization assemblies, based on my research there is not
built-in support on pregeneration of them(like what we can do in the .NET
2.0). So far what I can get are the following two options:

1. There exists an hotfix for .net 1.1's webservice client-side
application, we can use it to build a custom pregeneration tool to
pregenerate serialization assembies for webservcie client proxy. However,
this seems to be specific to webservice client proxy rather than all kinds
of xmlserization. You can have a look to see whether it helps:

#FIX: Web service clients regenerate serialization assemblies every time
that the application runs
http://support.microsoft.com/?id=872800

2.You can also try NGEN tool which can help make our .net
application/assembly prebuilt into native images, it can help improve
client application's startup performance.

#Native Image Generator (Ngen.exe)
http://msdn.microsoft.com/library/en...veimagegenerat
orngenexe.asp?frame=true
Hope this helps some.

Regards,

Steven Cheng
Microsoft Online Community Support
==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may

learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Mar 23 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.