[Mono-list] ilasm2 can't compile vbbyref marshalled parameter

Joe Mason joe at notcharles.ca
Fri Dec 14 00:48:57 EST 2007

I'm trying to make some small edits to a closed-source VB app to get
it running on Linux (the System.Drawing.Image.FromFile "OutOfMemory"
problem) by disassembling it with monodis and reassembling it with

ilasm2 gives an "unrecoverable syntax error" on this line (char 75):

    .method public static  pinvokeimpl ("kernel32" as
"GetVolumeInformationA" ansi winapi nomangle  lasterr )
           default int32 GetVolumeInformation (string& marshal
(vbbyrefstr) lpRootPathName, string& marshal (vbbyrefstr)
lpVolumeNameBuffer, int32 nVolumeNameSize, int32&
lpVolumeSerialNumber, int32& lpMaximumComponentLength, int32&
lpFileSystemFlags, string& marshal (vbbyrefstr)
lpFileSystemNameBuffer, int16 nFileSystemNameSize)  cil managed

The problem seems to by the "marshal (vbbyrefstr)" tags.  If I remove
them, it compiles fine (but then dies with a runtime error because it
can't find a copy of GetVolumeInformation with the correct signature).
 It also compiles if I change it to "marshal (int32)".

Is there anything I can do to get this compiling?  I assume the
problem is that vbbyrefstr was added by Visual Basic and ilasm2
doesn't recognize it - is there a fully-qualified type name I can
change it to?  (I can also change the call site to call marshalling
functions by hand if I have to, but I'm not sure where to start with


More information about the Mono-list mailing list