|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
weird problem with VS.NET 2003, win32 app and InteropI 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. 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 Show quote "Hermit Dave" wrote: > 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. > > -- > Regards, > > Hermit Dave > http://www.invokeit.co.uk |
|||||||||||||||||||||||