dotgnu-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [DotGNU]PInvoke question...


From: Rhys Weatherley
Subject: Re: [DotGNU]PInvoke question...
Date: Thu, 10 Jul 2003 08:47:21 +1000
User-agent: KMail/1.4.3

On Thursday 10 July 2003 08:46 am, Mark Easton wrote:

> Nonetheless, it doesn't really make any difference to what I'm trying to
> do as I'm not actually trying to get the registry code working on MacOS,
> but rather I'm just trying to get the code to throw a .NET exception
> that I can handle gracefully.

It won't in this case, by design.  The registry code probes the underlying OS 
to see if it is Win32.  It is is, then it will use the Win32 registry 
routines.  Otherwise it will use a fake registry implementation to fool dumb 
Windows programs.

This is supposed to be transparent, but the method that I chose has the 
side-effect of printing out a low-level debug message.  I will change it to 
detect Win32 in a different way so that the message doesn't appear.

Anyway, don't use the registry to store or retrieve settings.  The API is 
provided for legacy code only.  Use a flat text or XML file instead.

> However, I was under the assumption that
> all error messages should be pushed through as .NET exceptions rather
> than being written directly to the error stream?

Missing dynamic libraries are reported using a "MissingMethodException".  
However, in this case the exception was trapped by the registry code before 
it got back to the application.  As I said, this was by design.

Cheers,

Rhys.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]