Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Null Exception was unhandled - IdleDetectionMode.Disabled

Whenever I debug my windows phone app, whether it be on my phone or emulator I always get this Exception. How can I resolve this issue?

PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;

I'm still a beginner with this.

like image 966
Sun Avatar asked Sep 22 '11 11:09

Sun


2 Answers

I've had same issue. Clearing the \bin and \obj folders and then recompile solved it for me.

like image 54
JHP Avatar answered Oct 03 '22 21:10

JHP


That's not a exception.

What I guess is the exception, is that the PhoneApplicationService isn't created. So you're getting a NullReferenceException.

Either add PhoneApplicationService = new PhoneApplicationService() on the line above, or ensure following XAML are in your App.xaml

<Application.ApplicationLifetimeObjects>
    <!--Required object that handles lifetime events for the application-->
    <shell:PhoneApplicationService 
        Launching="Application_Launching" Closing="Application_Closing" 
        Activated="Application_Activated" Deactivated="Application_Deactivated"/>
</Application.ApplicationLifetimeObjects>
like image 28
Claus Jørgensen Avatar answered Oct 03 '22 20:10

Claus Jørgensen