Skip to content

Implemements a System.Xml.Serialization based NServiceBus message serializer to allow better interoperability with non-NServiceBus peers.

Notifications You must be signed in to change notification settings

ParticularLabs/NServiceBus.Serializers.SystemXml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

Implemements a System.Xml.Serialization based NServiceBus message serializer to allow better interoperability with non-NServiceBus peers.

Usage

In the Init method of an IWantToRunBeforeConfiguration, call Configure.Serialization.SystemXml(s=>s.SkipWrappingSingleMessage());.

Notes

The System.Xml.Serialization is currently known to trigger undesirable behavior in the 64 bit .NET JIT optimizer (Microsoft Connect issue about the issue).

The memory consuption issue seems to be resolved with the next major release of the .NET JIT RyuJIT. It can also be avoided by using the current 32-Bit VM (e.g. by using the 32-bit NServiceBus host executable).

Implementing 64-Bit JIT workaround

If there is memory trouble with serializing messages using this serializer and the 64 bit VM has to be used, do the following.

  1. Create sgened assembly for the contracts assembly by adding the following to the msbuild for the contract. In order for sgen to work properly, it's adviced that an assembly be created per contract.
<Target Name="AfterBuild" DependsOnTargets="AssignTargetPaths;Compile;ResolveKeySource" Inputs="$(MSBuildAllProjects);@(IntermediateAssembly)" Outputs="$(OutputPath)$(_SGenDllName)">
    <Delete Files="$(TargetDir)$(TargetName).XmlSerializers.dll" ContinueOnError="true" />
    <SGen BuildAssemblyName="$(TargetFileName)" BuildAssemblyPath="$(OutputPath)" References="@(ReferencePath)" ShouldGenerateSerializer="true" UseProxyTypes="false" KeyContainer="$(KeyContainerName)" KeyFile="$(KeyOriginatorFile)" DelaySign="$(DelaySign)" ToolPath="$(TargetFrameworkSDKToolsDirectory)" Platform="$(Platform)">
      <Output TaskParameter="SerializationAssembly" ItemName="SerializationAssembly" />
    </SGen>
</Target>
  1. Disable the JIT optimizer on the generated assembly by creating a .NET debugging control config file for the XMLSerializer assembly created above. For example
[.NET Framework Debugging Control]
GenerateTrackingInfo=1
AllowOptimize=0

About

Implemements a System.Xml.Serialization based NServiceBus message serializer to allow better interoperability with non-NServiceBus peers.

Resources

Stars

Watchers

Forks

Packages

No packages published