[Mono-list] Fwd: ilasm2 can't compile vbbyref marshalled parameter
sebastien.pouliot at gmail.com
Sat Dec 15 10:42:30 EST 2007
On Fri, 2007-12-14 at 22:57 -0500, Joe Mason wrote:
> On 12/14/07, Sebastien Pouliot <sebastien.pouliot at gmail.com> wrote:
> > Hello Joe,
> > On Fri, 2007-12-14 at 00:48 -0500, Joe Mason wrote:
> > > 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.
> > Has the problem been filled in bugzilla.ximian.com ? because AFAIK
> > there's none in FromFile, unless the file is bad.
> As far as I could tell from Googling, the problem is with the .NET
> design, rather than mono itself - at least, lots of people are
> reporting it for .NET apps they're writing themselves, often in VB,
> and I assume most of these use Microsoft's .NET.
> The problem is that FromFile throws OutOfMemory on any error condition
> (permissions problems, bad image format, etc). See the following two
> posts - the first advises people to use OpenRead and FromStream, and
> the second has a huge list of people saying, "I got the same
> exception, but my problem was something different!"
> I had assumed that Mono's FromFile was just following the Microsoft
> behaviour for compatibility, even though it would be better to have it
> throw a wider range of errors.
> I can't really file a bug until I'm sure why this particular code
> causes the exception, though, otherwise I don't have a very repeatable
> bug report.
Ok, I understand now. It's true that GDI+, and libgdiplus in our case,
returns OutOfMemory for a lot of things that aren't memory related. In
fact it seems many NULL checks return OutOfMemory :(
> > FromStream can have some issues on Win32 (only) since the way MS deals
> > with loading requires the stream to be alive as long as the image.
> Thanks, good to know.
> (snip errors when pinvoking GetVolumeInformationA)
> > Have a look at pinvoke.net
> Uh, it just occured to me - will pinvoking this even WORK on Linux,
> even if I get it to compile?
No, it will work with Mono on Windows but not on Linux.
> I do have Wine installed, so I have a
> version of this function somewhere, but getting Mono to find it sounds
> like a huge hassle.
As of today Mono doesn't run under Wine.
> Surely .NET has its own equivalent that could be
> called natively?
There are some similar API in the FX. Not all of them are currently
supported by Mono, but someone is working on some of them (check
mono-list and mono-devel mailing list archives).
> Thanks for the help,
More information about the Mono-list