Xbox One enforces time limits on when a title must perform several actions to avoid being terminated.
The following methods must be called within the specified time limits after the title has been started or the title will be terminated.
| Method | Time Limit |
|---|---|
| ICoreWindow::Activate | 45 seconds. If your app hasn’t returned from its activation handler within this time, it will be terminated for not launching quickly enough. |
| CoreApplication::Run | 45 seconds |
| CoreApplication::Suspending | The suspend timeout for exclusive apps is 1 second. The suspend completion handler fires 5 seconds after a shared app becomes non-visible. |
While the time limits for the Activate and Run events are 45 seconds, your application should not take this long to start. Every application should enter a user-facing run state much more quickly than the 45 second limit. See the Xbox Requirements for details and requirements concering startup time.
By default, if an unhandled kernel exception is encountered in the exclusive OS, the exclusive partition attempts to shut down. If the partition does not safely shut down in 10 seconds, the partition is terminated. This is the same as retail console behavior.
In this release, xbconfig supports the EnableKernelDebugging flag for your use in controlling this behavior.
xbconfig.exe EnableKernelDebugging=1, your dev kit is configured to wait indefinitely for you to connect a kernel debugger (KD or WinDBG) after the exlusive OS encounters an unhandled kernel exception.xbconfig.exe EnableKernelDebugging=0 configures your dev kit to follow the default behavior and terminate the exclusive partition if it has not shut down within ten seconds after encountering an unhandled kernel exception.In order to meet these time limits titles should follow these guidelines.
The following code is an example of how activation code can be set up to ensure a title does not exceed the activation time limits. Note that the amount of processing done is kept to a minimum until ICoreWindow::Activate has been called in the Activated event handler. The majority of intitialization occurs in Run after a flag has been set indicating activation has completed.
The example methods IntitializeLoadingScreen, RenderSingleFrame, and InitializeEngine are an example of a pattern where just enough of the game engine is initialized to display a loading screen after which the remaining engine initialization is performed.
void ViewProvider::Initialize(CoreApplicationView^ applicationView)
{
applicationView->Activated += ref new
TypedEventHandler<CoreApplicationView^, IActivatedEventArgs^>(this, &ViewProvider::OnActivated);
}
void ViewProvider::SetWindow(CoreWindow^ window)
{
}
void ViewProvider::Load(String^ entryPoint)
{
}
void ViewProvider::Run()
{
auto dispatcher = CoreWindow::GetForCurrentThread()->Dispatcher;
while (!_activationComplete)
{
dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent);
}
InitializeLoadingScreen();
RenderSingleFrame();
InitializeEngine();
while(!_shouldExit)
{
dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent);
RunFrame();
}
}
void ViewProvider::OnActivated(CoreApplicationView^ applicationView, IActivatedEventArgs^ args)
{
CoreWindow::GetForCurrentThread()->Activate();
_activationComplete = true;
}