Click here to Skip to main content
15,885,782 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hello,
I have developed a C# application running on Windows 7 (32 bit) called RBS07.exe which accesses a remote SQL database. It is now ready for testing and so I need to install the .exe on a Windows 7 (64 bit) machine. After compiling on the development box I copied the RBS07.exe to the test PC and set up the appropriate ODBC connections. However when I run this RBS07.exe on the test PC , it displays the 1st window and subsequently crashes (I suspect when attempting to connect to the remote SQL server. The error message is "Unhandled error has occurred in your application - Object reference not set to an instance of an Object"

The Test PC does not have MS Visual 2010 installed. Is there any way that I can get more information on what is causing the error ?

regards
Pat
Posted

Remote debugging is a feature of Visual Studio.

Install this on your remote machine.

http://www.microsoft.com/en-us/download/details.aspx?id=475

Search MSDN for instructions on using remote debugging.
 
Share this answer
 
v2
Comments
Valery Possoz 3-Jan-14 16:56pm    
Yep! That's what I would do :)
Yes, Logging.

log4net Tutorial[^]

This will really give you a handle on what the application is telling you.

One thing though, when this application is copied, are you just copying the exe? do you not need the app.config file with it or is this embedded within the exe?

Have you tried ClickOnce for the deployment?
 
Share this answer
 
Since you are developing in 32-bit environment, compile it to 32-bit code and see if it works on win-64.

If this fails, possibly, you are not distributing all dlls used in your program.

I usually use "old fashioned" logging to solve problems like you are facing now. Just write to log from areas where you suspect code is broken. You will eventually nail it down. Logging is always helpful. You never know where and when your application will break. Analyzing logs helps a lot.
Good luck.
 
Share this answer
 
v2
Comments
Nelek 3-Jan-14 17:25pm    
If that is the case, one possibility to know what is needed is Dependency Walker
The "Object reference is not set to an instance of an object" is your biggest clue. Somewhere in your code, you're expecting an object to be returned, but you're getting null back instead. Your code never checks for this condition. It's just assuming that the object will be created every single time. You then try to call a method or proeprty on the object and this is where the error shows up. A null object has no properties or methods, so...

Like has already been said, instrument your code with logging to track what's it's doing and what methods are being called so you can narrow down where to look in your code.
 
Share this answer
 
Further to the other solutions I can recommend the Windows SysInternals suite of tools - see http://technet.microsoft.com/en-us/sysinternals/bb545021.aspx[^] - they're free.

In this instance I would (personally) load up Process Monitor (ProcMon) - it's reasonably intuitive to use plus there's loads on info on the link above. You don't need to make any changes to your program. I often use it to work out what's going wrong with 3rd party stuff and logging can only take you so far

You should be able to determine exactly what was happening when the error happened - you can filter for particular program names and turn on/off views of registry access, file access etc.

Hint: There is a fair amount of "noise" produced when the error message itself is being displayed ... you'll need to page up the results a bit
 
Share this answer
 
XML
Wow,
what a great response - thanks to everyone who responded. The problem was due to the .config file not being in place.  Once I copied this across , everything worked. However I was unaware of Log4Net before now and will definitely implement it into this project. 

regards
Pat
 
Share this answer
 
Comments
db7uk 5-Jan-14 15:09pm    
No problem.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900