UWP: enabling Windows.UI.Composition

If you want to play around with the supercool new Windows.UI.Composition API in Windows Universal apps, you'll need to keep in mind that the API is still in preview. The API is subject to change and a final version is expected to be available later this year. This however should not stop you from giving it a spin.

The problem

Unfortunately, when creating a new Universal Windows app and accessing the Windows.UI.Composition classes, you might run into the following error;

An exception of type 'System.UnauthorizedAccessException' occurred in xxx.exe but was not handled in user code

Additional information: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

The solution

Access to the preview Composition API is by default restricted, you'll need to add a capability to your appxmanifest. Here's how;

  1. Open your app's package.appxmanifest in a code editor (in context menu select View Code)
  2. Add the following xmlns namespace to the root Package element;
    xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
  3. Add the following capability to the Capabilities
    <rescap:Capability Name="previewUiComposition"></rescap:Capability>

For a full sample Package.appxmanifest see this package.appxmanifest on GitHub

Learn more



Latest News

RSS feed

Subscribe to the RSS feed and receive the latest news from First Floor Software in your favorite RSS reader.

Subscribe