Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have only gotten it to work on the simulator. I created the custom serialization assembly on VS.NET 2010. One issue I had was that the IL/DLL that gets created had the wrong namespace. I did something like this:</p> <pre><code>model.Compile("X.Y.Serializer.MySerializer", "X.Y.Serializer.dll") </code></pre> <p>But the IL was something like:</p> <pre><code>.assembly X.Y.Serializer.MySerializer { .hash algorithm 0x00008004 .ver 0:0:0:0 } .module X.Y.Serializer.MySerializer </code></pre> <p>I.e. the class name was in the assembly name.</p> <p>So I wrote a perl program to:</p> <ul> <li>Decompile DLL -> IL</li> <li>Fix IL</li> <li>Compile IL -> DLL</li> </ul> <p>Here is the script:</p> <pre><code>#!/usr/bin/perl # Usage: fix-protobuf-assembly assembly bad-namespace # # Example: fix-protobuf-assembly X.Y.Serializer.dll X.Y.Serializer.MySerializer # X.Y.Serializer.MySerializer gets converted to X.Y.Serializer use strict; use File::Slurp; use Cwd; print "Current directory is " . getcwd() . "\n"; my $asm_file = shift || die "missing assembly file"; my $bad_ns = shift || die "missing namespace"; die "no such file '$asm_file'" if (! -f $asm_file); my $il_file = $asm_file; $il_file =~ s#dll$#il#; Run("ildasm /out=$il_file $asm_file"); my $il = read_file($il_file) || die "error reading $il_file: $!"; my $ns = $bad_ns; $ns =~ s#\.[^.]+$##; if (($il =~ s#(\.assembly|module) $bad_ns#$1 $ns#g) == 0) { die "$bad_ns not found in input dll; aborting"; } write_file($il_file, $il); Run("ilasm /dll $il_file"); sub Run { my($command) = @_; warn "Running $command ...\n"; system($command) &amp;&amp; die "error running last command; bailing out"; } </code></pre> <p>Maybe I just missed the proper way to call Compile() and my hack is unnecessary. </p> <p>The assembly worked fine on Windows and iOS simulator. But it then gave a runtime JIT compile violation error on the device. I just created a SO question:</p> <p><a href="https://stackoverflow.com/questions/7940838/jit-compile-error-with-protobuf-net-on-monotouch-ios-device-iphone-ipad">JIT compile error with protobuf-net on MonoTouch/iOS device (iPhone/iPad)</a></p> <p>I did try using MonoDevelop on Mac w/ standard console project to first create the serialization assembly. I had some issues, but to be honest I was sleepy and grumpy and it could have been user error, and quickly decided to jump over to Windows since my project has other components that I develop there.</p> <p>I used .NET 4.0 projects on Windows and everything worked OK. I just had to create a lightweight version of two MT-only libraries so that I could access the classes that would be serialized.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload