weird problem with VS.NET 2003, win32 app and Interop

G

Guest

Hi,

I am facing a strange problem.
I am using c# 1.1, Visual Studio 2003 on Windows XP SP2

I have a middle-tier project that calls some win32 api's like OpenMutex,
CreateMutex etc (the Mutex class in c# 1.x is not helpful enough). The
middle-tier project is used by a Windows App and a web app.

The problem is running the windows app:
* If visual studio is running then both OpenMutex and CreateMutex fail with
win32 error code 5 which when read using new Win32Exception(); contains
message Access is denied.

* However if i close VS.NET and then run the compiled application it doesn't
throw this errror any more. The OpenMutex / CreateMutex behave as they should.

* If i create a console application and use the same code, the code works
fine (with or without vs.net running)

I have tried the following:
* Mark the class as unsafe and in project enabled allow unsafe blocks
* Added SecurityPermission attribute using SecurityAction.LinkDemand,
enabling unmanaged = true

I would be very thankful if any one has had similar problems and knows of
any known workarounds.
 
G

Guest

BTW,

I continued to have this problem from yesterday evening until today well in
the afternoon.

I just commented out the code that threw the exception (i added it as it was
not working) and after reboot it all seems to work okay right now

Will update the log if i get the problem again
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top