cache serializer between dll calls

Topics: Developer Forum, User Forum
Sep 10, 2007 at 11:02 AM
Is it possible to cache a serializer between dll calls?
I have written a "Callout"-Dll for MSCRM (is a kind of trigger for events on MSCRM-records like update, create, ..) which needs to desrialize the the DynamicEntity-XML passed from MSCRM into a DynamicEntity-Object.
This process needs with "normal" XML-Serializer 5 to 8 seconds, what's not useable.
Now I've tried it with Mvp.Xml.Common.Serialization.XmlSerializerCache. But it's as slow as it was.
Can somebody bring ligth into this issue?
Oct 17, 2007 at 2:47 PM
Hi Thomas,

i have problems with web service serialization (.NET 2.0). For me there are 2 major problems:
  1. on-demand compilation of the webservice proxy types
  2. instantiation of the webservice proxy classes (base class: SoapHttpClientProtocol)

We have about 20 different webservices published by out J2EE application server; the generated proxy source code (wsdl) contains several 100 types. The first instatiation of most of the service proxies takes about 5-10 secs. The proxy code is used in our Windows.Forms client, which shows these delays when using the webservice proxies the first time.
To get rid of this issue we tried to precompile the the serialization code by use of the too sgen.exe; precompilation works (no more on-demand compiled assemblies), but performance is pretty much the same as before. When running my application in the debuuger and stopping it immediately when a instantiation of a new webservice proxy started i see an interesting callstack.

  System.Web.Services.dll!System.Web.Services.Protocols.SoapReflector.ReflectMethod(System.Web.Services.Protocols.LogicalMethodInfo methodInfo = {System.Web.Services.Protocols.LogicalMethodInfo}, bool client, System.Xml.Serialization.XmlReflectionImporter xmlImporter, System.Xml.Serialization.SoapReflectionImporter soapImporter, string defaultNs) + 0xe0d Bytes 
  System.Web.Services.dll!System.Web.Services.Protocols.SoapClientType.GenerateXmlMappings(System.Type type, System.Collections.ArrayList soapMethodList = Count = Der Ausdruck kann nicht ausgewertet werden, da sich ein systemeigener Frame oben in der Aufrufliste befindet., string serviceNamespace = "http://www.themindelectric.com/wsdl/AkteWebService/", bool serviceDefaultIsEncoded, System.Collections.ArrayList mappings = Count = Der Ausdruck kann nicht ausgewertet werden, da sich ein systemeigener Frame oben in der Aufrufliste befindet.) + 0xc2 Bytes 
  System.Web.Services.dll!System.Web.Services.Protocols.SoapClientType.SoapClientType(System.Type type = {Name = Der Ausdruck kann nicht ausgewertet werden, da sich ein systemeigener Frame oben in der Aufrufliste befindet. FullName = Der Ausdruck kann nicht ausgewertet werden, da sich ein systemeigener Frame oben in der Aufrufliste befindet.}) + 0x11e Bytes 
  System.Web.Services.dll!System.Web.Services.Protocols.SoapHttpClientProtocol.SoapHttpClientProtocol() + 0xfe Bytes 
> ProxyTransformerTest.exe!AkteWebService.AkteWebService() Zeile 34 + 0x7 Bytes C#

The precompiled assembly is not used at this point. As before XmlMappings are created by reflection and this task takes again 5-10 secs.

You could try to get a callstack like this and post it here.
Did you use wsdl and sgen?

Regards, Walter
Oct 29, 2007 at 1:44 PM
Hi Walter, thank you for your input.
In my scenario there is no web service involved. It is only local dll-calls.
I have not used sgen.
regards
Thomas