Writing mixed assembly doesn't work, but is it supposed to?

109 views
Skip to first unread message

Larry S. Smith

unread,
Dec 7, 2011, 4:12:28 AM12/7/11
to mono-cecil
On a two liner, ReadAssembly, then Write it dies with

Unhandled Exception: System.ArgumentException: Value does not fall
within the expected range.
at Mono.Cecil.ModuleWriter.WriteModuleTo(ModuleDefinition module,
Stream stream, WriterParameters parameters) in D:\cecil\jbevain-
cecil-0.9.5-56-g5c32193\Mono.Cecil\AssemblyWriter.cs:line 87
at Mono.Cecil.ModuleDefinition.Write(Stream stream,
WriterParameters parameters) in D:\cecil\jbevain-cecil-0.9.5-56-
g5c32193\Mono.Cecil\ModuleDefinition.cs:line 977
at Mono.Cecil.ModuleDefinition.Write(String fileName,
WriterParameters parameters) in D:\cecil\jbevain-cecil-0.9.5-56-
g5c32193\Mono.Cecil\ModuleDefinition.cs:line 966
at Mono.Cecil.AssemblyDefinition.Write(String fileName,
WriterParameters parameters) in D:\cecil\jbevain-cecil-0.9.5-56-
g5c32193\Mono.Cecil\AssemblyDefinition.cs:line 175
at Mono.Cecil.AssemblyDefinition.Write(String fileName) in D:\cecil
\jbevain-cecil-0.9.5-56-g5c32193\Mono.Cecil\AssemblyDefinition.cs:line
165
at My.Hack.Main(String[] args) in D:\cecil\MyHack.cs:line 57

when writing back a C++ to managed wrapper. As I have both x86 and x64
of that code, I tried it on both, and the stack trace is identical.
Unfortunately, I can't make this assembly public, but if writing mixed
assemblies is *supposed* to work instead of being a known limitation,
I'll try to reproduce it on a small example that I can make public.

Larry S. Smith

unread,
Dec 7, 2011, 4:38:06 AM12/7/11
to mono-cecil
I get the same stack trace if I try it on the code produced by the
pragma_directives_managed_unmanaged.cpp example from
http://msdn.microsoft.com/en-us/library/0adb9zxe.aspx So, I guess
writing mixed assemblies is broken in general.

Simon Goldschmidt

unread,
Dec 7, 2011, 5:02:59 AM12/7/11
to mono-...@googlegroups.com
"Larry S. Smith" <larry...@aim.com> wrote:
> [mono-cecil] Writing mixed assembly doesn\'t work, but is it supposed to?

Unfortunately, the short answer is no, writing mixed assemblies is not supposed to work. :-(

Simon
--
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de

Jb Evain

unread,
Dec 7, 2011, 6:17:46 AM12/7/11
to mono-...@googlegroups.com
Hi,

On Wed, Dec 7, 2011 at 10:38 AM, Larry S. Smith <larry...@aim.com> wrote:
> So, I guess
> writing mixed assemblies is broken in general.

It's not broken, it's just not supported.

But I'll add that to the FAQ.

Jb

Reply all
Reply to author
Forward
0 new messages