Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Serialization Assembly. Is it needed or not?

Tags:

I have a .net 2.0 c# ClickOnce app and it connects to its data via Web Services. I've been told that one way to potentially speed up the application is to generate a serialization assembly beforehand. I have several questions on this front.

  1. The default setting to whether to generate a serialization assembly is Auto. What criteria does VS2005 use to decide whether to generate a serialization assembly or not? It seems like it does not generate under Debug configuration, but it does under Release configuration, but I can't tell for sure and can't the information anywhere.

  2. Does serialization assembly actually improve the startup of the application? Specifically what does it improve? Do I actually need a serialization assembly?

like image 787
AngryHacker Avatar asked May 29 '09 16:05

AngryHacker


People also ask

What is serialization assembly?

The serialization assembly improves the startup performance of a XmlSerializer when it serializes or deserializes objects of the specified types.

Why do we need serialization?

Serialization allows the developer to save the state of an object and re-create it as needed, providing storage of objects as well as data exchange. Through serialization, a developer can perform actions such as: Sending the object to a remote application by using a web service.

What are the types of serialization?

There are three types of serialization in . Net : Binary Serialization, SOAP Serialization and XML Serialization.


2 Answers

It is really asking "Shall I pre-generate the serialization assemblies and include it in the deployed project or shall I fall back on the default of generating the assemblies on the fly?" Generally that won't hurt too much after the first hit perf-wise. Where it can play in is that the serialization assemblies are generated in %SYSTEMROOT%\TEMP. Which, in some cases, the process can't access, leading to fatal exceptions in most cases.

like image 165
Wyatt Barnett Avatar answered Oct 05 '22 12:10

Wyatt Barnett


This is not relevant to your situation, but there's another good reason for pre-generating the serialization assembly - it's necessary when hosting your code in SQL Server (i.e. SQLCLR). SQL Server doesn't allow these assemblies to be generated dynamically, so your serialization code would fail inside SQL Server.

like image 24
Dave Cluderay Avatar answered Oct 05 '22 14:10

Dave Cluderay