title: Exception when creating Swap Chain with CreateSwapChainForComposition
body: <p>I am trying to render <strong>DirectX12</strong> in <strong>SwapChainPanel</strong> by using <strong>SharpDx</strong> but creating a SwapChain fails for an unknown reason. Here is a simplified version of what I have:</p>
  
  <pre><code>// select adapter based on some simple scoring mechanism
  SelectedAdapter = SelectAdapter();
  
  // create device
  using (var defaultDevice = new Device(SelectedAdapter, FeatureLevel.Level_12_0))
      Device = defaultDevice.QueryInterface&lt;SharpDX.Direct3D12.Device2&gt;();
  
  // describe swap chain
  SwapChainDescription1 swapChainDescription = new SwapChainDescription1
  {
      AlphaMode = AlphaMode.Ignore,
      BufferCount = 2,
      Format = Format.R8G8B8A8_UNorm,
      Height = (int)(MainSwapChainPanel.RenderSize.Height),
      Width = (int)(MainSwapChainPanel.RenderSize.Width),
      SampleDescription = new SampleDescription(1, 0),
      Scaling = Scaling.Stretch,
      Stereo = false,
      SwapEffect = SwapEffect.FlipSequential,
      Usage = Usage.RenderTargetOutput
  };
  
  // create swap chain
  using (var factory2 = SelectedAdapter.GetParent&lt;Factory2&gt;())
  {
      /*--&gt; throws exception:*/
      SwapChain1 swapChain1 = new SwapChain1(factory2, Device, ref swapChainDescription);
      SwapChain = swapChain1.QueryInterface&lt;SwapChain2&gt;();
  }
  
  // tie created swap chain with swap chain panel
  using (ISwapChainPanelNative nativeObject = ComObject.As&lt;ISwapChainPanelNative&gt;(MainSwapChainPanel))
      nativeObject.SwapChain = SwapChain;
  </code></pre>
  
  <p>Selection of adapter works as expected (I have 2 adapters + software adapter). I can create a device and I can see that the app in task manager is using that selected adapter.</p>
  
  <p>Creation of the swap chain is based mostly on this documentation here: <a href="https://docs.microsoft.com/en-us/windows/uwp/gaming/directx-and-xaml-interop#swapchainpanel-and-gaming" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/windows/uwp/gaming/directx-and-xaml-interop#swapchainpanel-and-gaming</a></p>
  
  <p>I get <em>factory2</em> (with all the adapters and other things enumerated). Constructor of <em>SwapChain1</em> internally is using <em>factory2</em> to create a swap chain: <a href="https://github.com/sharpdx/SharpDX/blob/master/Source/SharpDX.DXGI/SwapChain1.cs#L64" rel="nofollow noreferrer">https://github.com/sharpdx/SharpDX/blob/master/Source/SharpDX.DXGI/SwapChain1.cs#L64</a></p>
  
  <p>I compared this method with several others examples and tutorials and this is the way it should be done, however, regardless of the <em>Format</em> I choose or adapter, I keep getting this exception:</p>
  
  <blockquote>
    <p>{SharpDX.SharpDXException: HRESULT: [0x887A0001], Module:
    [SharpDX.DXGI], ApiCode: [DXGI_ERROR_INVALID_CALL/InvalidCall],
    Message: The application made a call that is invalid. Either the
    parameters of the call or the state of some object was incorrect.
    Enable the D3D debug layer in order to see details via debug messages.</p>
    
    <p>at SharpDX.Result.CheckError()    at
    SharpDX.DXGI.Factory2.CreateSwapChainForComposition(IUnknown
    deviceRef, SwapChainDescription1&amp; descRef, Output restrictToOutputRef,
    SwapChain1 swapChainOut)    at SharpDX.DXGI.SwapChain1..ctor(Factory2
    factory, ComObject device, SwapChainDescription1&amp; description, Output
    restrictToOutput)    at UI.MainPage.CreateSwapChain()}</p>
  </blockquote>
  
  <p><em>DebugLayer</em> doesn't show any additional info.</p>
  
  <p>The app itself is a regular Windows Universal Blank App (min target version Creators Update 15063). I know I can run Directx12 on my current hardware (C++ hello world works just fine).</p>
  
  <p>Any ideas what is wrong?</p>