2

I'm facing problem with suspend functionality in windows 10 universal application. For first time log in i have some logic with requests to api in order to load information for the user just logged in. During this initial loading if "start" button is pressed app should go through suspending but it does not reaches "OnSuspending". I follow some step in order to trouble shoot the problem. In generated mini dump i found something strange:

EXCEPTION_CODE: (NTSTATUS) 0xc0000194 - {EXCEPTION}  Possible deadlock condition.

STACK_TEXT:    
ntdll!NtWaitForMultipleObjects+0x6
KERNELBASE!WaitForMultipleObjectsEx+0x112
twinapi_appcore!Event::WaitWithFreeUnusedLibraries+0x88
twinapi_appcore!Windows::ApplicationModel::Core::CoreApplicationFactory::RunInternal+0x208
twinapi_appcore!Windows::ApplicationModel::Core::CoreApplicationFactory::Run+0x12
Windows_UI_Xaml!RunInActivationMode+0x58
Windows_UI_Xaml!DirectUI::FrameworkApplicationFactory::Start+0x32
0x2d0684

BUCKET_ID:  c0000194_twinapi_appcore!Event::WaitWithFreeUnusedLibraries+88

I can reproduce it only on device and not on emulator.

Daniel Filipov
  • 325
  • 4
  • 17

1 Answers1

1

In the Universal Windows 10 Apps you should use Background Tasks if you would like to perform any background operations. The reason why your app is in deadlock is that you start calling the Api and suspending the app in the same time. Please try to use below tutorial which shows how to implement Background Tasks (with good description):

https://msdn.microsoft.com/en-us/windows/uwp/launch-resume/create-and-register-a-background-task

You can also use ready sample from my GitHub:

https://github.com/Daniel-Krzyczkowski/Windows10/tree/master/BackgroundTasksDemo

Daniel Krzyczkowski
  • 2,732
  • 2
  • 20
  • 30