Object reference not set to an instance of an object

Ask general questions here.
User avatar
subodh4u7
Posts: 71
Joined: Tue Jan 06, 2015 8:26 am

Object reference not set to an instance of an object

Post by subodh4u7 » Fri Aug 07, 2015 6:26 am

Hello Team,

My application is based on .net framework 4.5 and using Ranorex 5.2.
Whenever i run my test solution it fails first time because of error " Object reference not set to an instance of an object" .

However when i run the solution second time, it passes without any such error.

Why such behavior are observed with Ranorex test solution.
e.g. please find the piece of code:

Code: Select all

[2015/08/06 16:16:36.082][UIAction][Passed ]: RepoScanConsole.WindowStart.Self.Click()
[2015/08/06 16:16:36.695][UIAction][Passed ]: RepoScanConsole.StartMenu.SearchBoxStartMenu.PressKeys(cmd)
[2015/08/06 16:16:37.483][UIAction][Passed ]: RepoScanConsole.StartMenu.CmdExeStartMenu.Click(Right)
[2015/08/06 16:16:38.254][UIAction][Passed ]: RepoScanConsole.StartMenuExplorerContextMenu.RunAsAdministratorCMD.Click()
[2015/08/06 16:16:38.318][Exception][UIAction ]: thrown in: RepoScanConsole.CommandPrompt.Activate()
[b][2015/08/06 16:16:38.343][Error  ][Module]: Object reference not set to an instance of an object.[/b]
Please help me to avoid such issues and because of this we are getting so much pressure from our manager which is not good to be.
Regards,
Subodh

CookieMonster
Certified Professional
Certified Professional
Posts: 74
Joined: Mon Aug 14, 2006 7:17 pm
Location: CH

Re: Object reference not set to an instance of an object

Post by CookieMonster » Fri Aug 07, 2015 7:17 am

Hi subodh4u7,

It's hard to say what exactly is throwing the exception, because I don't know your code. But you can try to debug the method, RepoScanConsole.CommandPropt.Activate(), and figure it which object is not set.

Regards
Dan