title: When we print the document in full screen mode System.AccessViolationExcpetion has thrown. Platform : UWP
body: <p>When we add UI element in the AddPages() method of PrintDocument (Windows.UI.Xaml.Printing.PrintDocument), the System.AccessViolationException has been thrown.</p>
  
  <p>Note : The same code works fine when we print the document in PreferredLaunchViewSize mode. If we print the document in FullScreen mode the exception thrown.</p>
  
  <p>Code snippet:</p>
  
  <pre><code>PrintDocument printdocument = new PrintDocument();
  Dictionary&lt;int, UIElement&gt; printPreviewPages = new Dictionary&lt;int, UIElement&gt;();
  Canvas print = PrintPanel.Children[i] as Canvas;
  if (printPreviewPages.Count &lt; i + 1)
     printPreviewPages.Add(i, print);
  printdocument.AddPages(printPreviewPages[i]);
  </code></pre>
  
  <p>To change the windowing size:
  PreferredLaunchViewSize :</p>
  
  <pre><code>ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize;
  </code></pre>
  
  <p>FullScreen mode :</p>
  
  <pre><code>ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.FullScreen;
  </code></pre>
  
  <p>Please let me know any way to resolve the exception.
  Thanks in advance.</p>