UIPermissionException thrown if run using Ctrl+F5
Whenever I try to run a XBAP browser application (start without debugging - using Ctrl F5) it throws the following error. I am able to debug it properly and if I publish the xbap (with full trust and keys imported) it works properly. Any reasons as to why it doesn't works with VS?
Below is the error I get in the browser.
Startup URI: D:\Projects\WPF\Reports\Reports\bin\Debug\Reports.xbap
Application Identity: file:///...//Reports.xbap, Version=1.0.0.0, Culture=neutral, PublicKeyToken=70b4404263ed37f0, processorArchitecture=msil/Reports.exe, Version=1.0.0.0, Culture=neutral, PublicKeyToken=70b4404263ed37f0, processorArchitecture=msil, type=win32
System.Windows.Markup.XamlParseException: Cannot create instance of 'MainPage' defined in assembly 'Reports, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Exception has been thrown by the target of an invocation. Error in markup file 'Reports;component/MainPage.xaml' Line 1 Position 7. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.UIPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)

