.NET program crashes involving stubbed functions

Adam Petaccia adam at tpetaccia.com
Wed Aug 13 13:59:58 CDT 2008


On Wed, 2008-08-13 at 19:32 +0100, Reece Dunn wrote:
> 2008/8/13 Adam Petaccia <adam at tpetaccia.com>:
> > Its customary to make a function return NotImplemented in Gdiplus, if
> > its just a dummy function that does nothing and returns. But .NET seems
> > to check for this and throw an exception, crashing the program anyway.
> >
> > See bug http://bugs.winehq.org/show_bug.cgi?id=12951 for details, but
> > originally a program crashed because GdipNewPrivateFontCollection was
> > just a stub. After the function was created, it still crashes because it
> > returns "NotImplemented", rather than "Ok". IIRC, we return
> > "NotImplemented" for some debugging reason, but if the goal of Wine is
> > to run Windows applications, should we just go ahead and return "Ok" so
> > that .NET apps don't freak out?
> >
> > Of course in a perfect world, we wouldn't have to fake a return code,
> > but until that time comes do people have opinions one way or another?
> 
> The problem with returning Ok is that it implies that the function
> succeeded in what it is intended to do. As a result, the application
> will continue and in this case expect to be able to use the private
> font collection. To prevent the application crashing, it is likely
> that several functions will need to be implemented.
> 
> Also note that the reporter of the bug mentions that they installed
> mono. This means that using MS.NET may lead to different behaviour. It
> also means that it should be possible to see how the
> GdipNewPrivateFontCollection call is being used by mono and the data
> that it returns.
> 
> So to summarise, I suspect this will require more than simply
> returning Ok.
Most likely in this particular case you would be correct. But the whole
reason we have stubs is so that (C/C++) programs don't crash, but try to
move on, possibly with impaired functionality, but (at least with mono)
this does absolutely zero good as the program terminates anyway, but
this time for a different reason. 

On a side note, I thought Wine's preferred .NET was mono anyway.

> 
> - Reece




More information about the wine-devel mailing list