Click to See Complete Forum and Search --> : System.NullReferenceException: Object reference not set to an instance of an object.


gamad
September 26th, 2006, 02:31 PM
Hi,

I wrote a C# application that works with a VC++ dll.
When I debug it, using F5, even without any breakpoints it works, but if I double click the exe file (its compiled in a debug version so I'm using the same exe), I get a NullReference exception when I get to the point where I call the C++ dll.

I checked it and its the same exe for sure.
What could be the problem???

Thanks,

naveenl
September 26th, 2006, 11:33 PM
One confirmation required,Is Dll present in folder where exe is present????

Shuja Ali
September 27th, 2006, 03:30 AM
Where is your DLL file located?

gamad
September 27th, 2006, 01:53 PM
My dll is located in the same folder where the exe is located.

Shuja Ali
September 28th, 2006, 03:04 AM
Put it into the System32 folder or in the BIN Folder.

gamad
September 28th, 2006, 11:35 AM
I tried that... didn't help....

falc0n
September 28th, 2006, 04:35 PM
Are you absolutely sure, that your VC++ dll contains no bugs?
I had the same problem and I found out that I have to fix something with memory management in my dll code ( don't remember what exactly it was). After that everything worked fine.

I was also confused, why my program didn't crash while debugging.

Check if dll code is bugs-free.
Hope this helps :)