System.AccessViolationException after upgrading to 1.1 stable
See original GitHub issueDescribe the bug
After upgrading the project from 1.1 preview 3 to 1.1 stable, project cannot be started as unpackaged anymore. The System.AccessViolationException is thrown from AccessWindowsAppSDK(): ‘Attempted to read or write protected memory. This is often an indication that other memory is corrupt.’
<WindowsPackageType>None</WindowsPackageType>
is added to the csproj file. 1.1.0 runtime installer (x64) and C# visual studio 2022 extension from https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/downloads have been installed.
Steps to reproduce the bug
- Create a new Blank App, Packaged (WinUI 3 in Desktop) project through Visual Studio 2022
- Keep the default NuGet packages: Microsoft.WindowsAppSDK 1.1.0, Microsoft.Windows.SDK.BuildTools 10.0.22000.197
- Add
<WindowsPackageType>None</WindowsPackageType>
to project file - Start the application as Debug - x64 - Unpackaged
Expected behavior
No response
Screenshots
Exception:
Project file:
NuGet package version
No response
Windows app type
- UWP
- Win32
Device form factor
Desktop
Windows version
Windows 10 (21H2): Build 19044
Additional context
Installed appruntime:
Name : Microsoft.WindowsAppRuntime.1.0-preview3
Publisher : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture : X86
ResourceId :
Version : 0.297.2018.0
PackageFullName : Microsoft.WindowsAppRuntime.1.0-preview3_0.297.2018.0_x86__8wekyb3d8bbwe
InstallLocation : C:\Program
Files\WindowsApps\Microsoft.WindowsAppRuntime.1.0-preview3_0.297.2018.0_x86__8wekyb3d8bbwe
IsFramework : True
PackageFamilyName : Microsoft.WindowsAppRuntime.1.0-preview3_8wekyb3d8bbwe
PublisherId : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle : False
IsDevelopmentMode : False
NonRemovable : False
IsPartiallyStaged : False
SignatureKind : Developer
Status : Ok
Name : Microsoft.WindowsAppRuntime.1.0-preview3
Publisher : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture : X64
ResourceId :
Version : 0.297.2018.0
PackageFullName : Microsoft.WindowsAppRuntime.1.0-preview3_0.297.2018.0_x64__8wekyb3d8bbwe
InstallLocation : C:\Program
Files\WindowsApps\Microsoft.WindowsAppRuntime.1.0-preview3_0.297.2018.0_x64__8wekyb3d8bbwe
IsFramework : True
PackageFamilyName : Microsoft.WindowsAppRuntime.1.0-preview3_8wekyb3d8bbwe
PublisherId : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle : False
IsDevelopmentMode : False
NonRemovable : False
IsPartiallyStaged : False
SignatureKind : Developer
Status : Ok
Name : Microsoft.WindowsAppRuntime.Singleton
Publisher : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture : X64
ResourceId :
Version : 1.440.209.0
PackageFullName : Microsoft.WindowsAppRuntime.Singleton_1.440.209.0_x64__8wekyb3d8bbwe
InstallLocation : C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.Singleton_1.440.209.0_x64__8wekyb3d8bbwe
IsFramework : False
PackageFamilyName : Microsoft.WindowsAppRuntime.Singleton_8wekyb3d8bbwe
PublisherId : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle : False
IsDevelopmentMode : False
NonRemovable : False
Dependencies : {Microsoft.WindowsAppRuntime.1.0_3.469.1654.0_x64__8wekyb3d8bbwe}
IsPartiallyStaged : False
SignatureKind : Store
Status : Ok
Name : Microsoft.WinAppRuntime.DDLM.1.440.209.0-x6
Publisher : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture : X64
ResourceId :
Version : 1.440.209.0
PackageFullName : Microsoft.WinAppRuntime.DDLM.1.440.209.0-x6_1.440.209.0_x64__8wekyb3d8bbwe
InstallLocation : C:\Program
Files\WindowsApps\Microsoft.WinAppRuntime.DDLM.1.440.209.0-x6_1.440.209.0_x64__8wekyb3d8bbwe
IsFramework : False
PackageFamilyName : Microsoft.WinAppRuntime.DDLM.1.440.209.0-x6_8wekyb3d8bbwe
PublisherId : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle : False
IsDevelopmentMode : False
NonRemovable : False
Dependencies : {Microsoft.WindowsAppRuntime.1.0_3.469.1654.0_x64__8wekyb3d8bbwe}
IsPartiallyStaged : False
SignatureKind : Developer
Status : Ok
Name : Microsoft.WinAppRuntime.DDLM.1.440.209.0-x8
Publisher : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture : X86
ResourceId :
Version : 1.440.209.0
PackageFullName : Microsoft.WinAppRuntime.DDLM.1.440.209.0-x8_1.440.209.0_x86__8wekyb3d8bbwe
InstallLocation : C:\Program
Files\WindowsApps\Microsoft.WinAppRuntime.DDLM.1.440.209.0-x8_1.440.209.0_x86__8wekyb3d8bbwe
IsFramework : False
PackageFamilyName : Microsoft.WinAppRuntime.DDLM.1.440.209.0-x8_8wekyb3d8bbwe
PublisherId : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle : False
IsDevelopmentMode : False
NonRemovable : False
Dependencies : {Microsoft.WindowsAppRuntime.1.0_3.469.1654.0_x86__8wekyb3d8bbwe}
IsPartiallyStaged : False
SignatureKind : Developer
Status : Ok
Name : Microsoft.WindowsAppRuntime.1.0
Publisher : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture : X64
ResourceId :
Version : 2.460.358.0
PackageFullName : Microsoft.WindowsAppRuntime.1.0_2.460.358.0_x64__8wekyb3d8bbwe
InstallLocation : C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.0_2.460.358.0_x64__8wekyb3d8bbwe
IsFramework : True
PackageFamilyName : Microsoft.WindowsAppRuntime.1.0_8wekyb3d8bbwe
PublisherId : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle : False
IsDevelopmentMode : False
NonRemovable : False
IsPartiallyStaged : False
SignatureKind : Store
Status : Ok
Name : Microsoft.WindowsAppRuntime.1.0
Publisher : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture : X64
ResourceId :
Version : 3.469.1654.0
PackageFullName : Microsoft.WindowsAppRuntime.1.0_3.469.1654.0_x64__8wekyb3d8bbwe
InstallLocation : C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.0_3.469.1654.0_x64__8wekyb3d8bbwe
IsFramework : True
PackageFamilyName : Microsoft.WindowsAppRuntime.1.0_8wekyb3d8bbwe
PublisherId : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle : False
IsDevelopmentMode : False
NonRemovable : False
IsPartiallyStaged : False
SignatureKind : Store
Status : Ok
Name : Microsoft.WindowsAppRuntime.1.0
Publisher : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture : X86
ResourceId :
Version : 3.469.1654.0
PackageFullName : Microsoft.WindowsAppRuntime.1.0_3.469.1654.0_x86__8wekyb3d8bbwe
InstallLocation : C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.0_3.469.1654.0_x86__8wekyb3d8bbwe
IsFramework : True
PackageFamilyName : Microsoft.WindowsAppRuntime.1.0_8wekyb3d8bbwe
PublisherId : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle : False
IsDevelopmentMode : False
NonRemovable : False
IsPartiallyStaged : False
SignatureKind : Store
Status : Ok
Name : MicrosoftCorporationII.WindowsAppRuntime.Main.1.0
Publisher : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture : X64
ResourceId :
Version : 3.469.1654.0
PackageFullName : MicrosoftCorporationII.WindowsAppRuntime.Main.1.0_3.469.1654.0_x64__8wekyb3d8bbwe
InstallLocation : C:\Program
Files\WindowsApps\MicrosoftCorporationII.WindowsAppRuntime.Main.1.0_3.469.1654.0_x64__8wekyb3d8bbwe
IsFramework : False
PackageFamilyName : MicrosoftCorporationII.WindowsAppRuntime.Main.1.0_8wekyb3d8bbwe
PublisherId : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle : False
IsDevelopmentMode : False
NonRemovable : False
Dependencies : {Microsoft.WindowsAppRuntime.1.0_3.469.1654.0_x64__8wekyb3d8bbwe}
IsPartiallyStaged : False
SignatureKind : Store
Status : Ok
Name : Microsoft.WindowsAppRuntime.1.1-preview3
Publisher : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture : X64
ResourceId :
Version : 1000.485.2229.0
PackageFullName : Microsoft.WindowsAppRuntime.1.1-preview3_1000.485.2229.0_x64__8wekyb3d8bbwe
InstallLocation : C:\Program
Files\WindowsApps\Microsoft.WindowsAppRuntime.1.1-preview3_1000.485.2229.0_x64__8wekyb3d8bbwe
IsFramework : True
PackageFamilyName : Microsoft.WindowsAppRuntime.1.1-preview3_8wekyb3d8bbwe
PublisherId : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle : False
IsDevelopmentMode : False
NonRemovable : False
IsPartiallyStaged : False
SignatureKind : Developer
Status : Ok
Name : Microsoft.WindowsAppRuntime.1.1-preview3
Publisher : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture : X86
ResourceId :
Version : 1000.485.2229.0
PackageFullName : Microsoft.WindowsAppRuntime.1.1-preview3_1000.485.2229.0_x86__8wekyb3d8bbwe
InstallLocation : C:\Program
Files\WindowsApps\Microsoft.WindowsAppRuntime.1.1-preview3_1000.485.2229.0_x86__8wekyb3d8bbwe
IsFramework : True
PackageFamilyName : Microsoft.WindowsAppRuntime.1.1-preview3_8wekyb3d8bbwe
PublisherId : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle : False
IsDevelopmentMode : False
NonRemovable : False
IsPartiallyStaged : False
SignatureKind : Developer
Status : Ok
Name : MicrosoftCorporationII.WinAppRuntime.Main.1.1-p3
Publisher : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture : X64
ResourceId :
Version : 1000.485.2229.0
PackageFullName : MicrosoftCorporationII.WinAppRuntime.Main.1.1-p3_1000.485.2229.0_x64__8wekyb3d8bbwe
InstallLocation : C:\Program Files\WindowsApps\MicrosoftCorporationII.WinAppRuntime.Main.1.1-p3_1000.485.2229.0_x64__
8wekyb3d8bbwe
IsFramework : False
PackageFamilyName : MicrosoftCorporationII.WinAppRuntime.Main.1.1-p3_8wekyb3d8bbwe
PublisherId : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle : False
IsDevelopmentMode : False
NonRemovable : False
Dependencies : {Microsoft.WindowsAppRuntime.1.1-preview3_1000.485.2229.0_x64__8wekyb3d8bbwe}
IsPartiallyStaged : False
SignatureKind : Developer
Status : Ok
Name : Microsoft.WindowsAppRuntime.Singleton-preview3
Publisher : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture : X64
ResourceId :
Version : 1000.485.2229.0
PackageFullName : Microsoft.WindowsAppRuntime.Singleton-preview3_1000.485.2229.0_x64__8wekyb3d8bbwe
InstallLocation : C:\Program
Files\WindowsApps\Microsoft.WindowsAppRuntime.Singleton-preview3_1000.485.2229.0_x64__8wekyb3d8bbwe
IsFramework : False
PackageFamilyName : Microsoft.WindowsAppRuntime.Singleton-preview3_8wekyb3d8bbwe
PublisherId : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle : False
IsDevelopmentMode : False
NonRemovable : False
Dependencies : {Microsoft.WindowsAppRuntime.1.1-preview3_1000.485.2229.0_x64__8wekyb3d8bbwe}
IsPartiallyStaged : False
SignatureKind : Developer
Status : Ok
Name : Microsoft.WinAppRuntime.DDLM.1000.485.2229.0-x6-p3
Publisher : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture : X64
ResourceId :
Version : 1000.485.2229.0
PackageFullName : Microsoft.WinAppRuntime.DDLM.1000.485.2229.0-x6-p3_1000.485.2229.0_x64__8wekyb3d8bbwe
InstallLocation : C:\Program Files\WindowsApps\Microsoft.WinAppRuntime.DDLM.1000.485.2229.0-x6-p3_1000.485.2229.0_x64
__8wekyb3d8bbwe
IsFramework : False
PackageFamilyName : Microsoft.WinAppRuntime.DDLM.1000.485.2229.0-x6-p3_8wekyb3d8bbwe
PublisherId : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle : False
IsDevelopmentMode : False
NonRemovable : False
Dependencies : {Microsoft.WindowsAppRuntime.1.1-preview3_1000.485.2229.0_x64__8wekyb3d8bbwe}
IsPartiallyStaged : False
SignatureKind : Developer
Status : Ok
Name : Microsoft.WinAppRuntime.DDLM.1000.485.2229.0-x8-p3
Publisher : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture : X86
ResourceId :
Version : 1000.485.2229.0
PackageFullName : Microsoft.WinAppRuntime.DDLM.1000.485.2229.0-x8-p3_1000.485.2229.0_x86__8wekyb3d8bbwe
InstallLocation : C:\Program Files\WindowsApps\Microsoft.WinAppRuntime.DDLM.1000.485.2229.0-x8-p3_1000.485.2229.0_x86
__8wekyb3d8bbwe
IsFramework : False
PackageFamilyName : Microsoft.WinAppRuntime.DDLM.1000.485.2229.0-x8-p3_8wekyb3d8bbwe
PublisherId : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle : False
IsDevelopmentMode : False
NonRemovable : False
Dependencies : {Microsoft.WindowsAppRuntime.1.1-preview3_1000.485.2229.0_x86__8wekyb3d8bbwe}
IsPartiallyStaged : False
SignatureKind : Developer
Status : Ok
Name : Microsoft.WindowsAppRuntime.1.1-preview1
Publisher : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture : X64
ResourceId :
Version : 1000.447.2307.0
PackageFullName : Microsoft.WindowsAppRuntime.1.1-preview1_1000.447.2307.0_x64__8wekyb3d8bbwe
InstallLocation : C:\Program
Files\WindowsApps\Microsoft.WindowsAppRuntime.1.1-preview1_1000.447.2307.0_x64__8wekyb3d8bbwe
IsFramework : True
PackageFamilyName : Microsoft.WindowsAppRuntime.1.1-preview1_8wekyb3d8bbwe
PublisherId : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle : False
IsDevelopmentMode : False
NonRemovable : False
IsPartiallyStaged : False
SignatureKind : Developer
Status : Ok
Name : Microsoft.WindowsAppRuntime.1.1
Publisher : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture : X86
ResourceId :
Version : 1000.516.2156.0
PackageFullName : Microsoft.WindowsAppRuntime.1.1_1000.516.2156.0_x86__8wekyb3d8bbwe
InstallLocation : C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.1_1000.516.2156.0_x86__8wekyb3d8bbwe
IsFramework : True
PackageFamilyName : Microsoft.WindowsAppRuntime.1.1_8wekyb3d8bbwe
PublisherId : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle : False
IsDevelopmentMode : False
NonRemovable : False
IsPartiallyStaged : False
SignatureKind : Store
Status : Ok
Name : Microsoft.WindowsAppRuntime.1.1
Publisher : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture : X64
ResourceId :
Version : 1000.516.2156.0
PackageFullName : Microsoft.WindowsAppRuntime.1.1_1000.516.2156.0_x64__8wekyb3d8bbwe
InstallLocation : C:\Program Files\WindowsApps\Microsoft.WindowsAppRuntime.1.1_1000.516.2156.0_x64__8wekyb3d8bbwe
IsFramework : True
PackageFamilyName : Microsoft.WindowsAppRuntime.1.1_8wekyb3d8bbwe
PublisherId : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle : False
IsDevelopmentMode : False
NonRemovable : False
IsPartiallyStaged : False
SignatureKind : Store
Status : Ok
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:10
Top Results From Across the Web
c# - Programs randomly getting System. ...
This issue is caused by the code which gathers return values. It is possible to work around the issue by disabling Managed return...
Read more >The game crashed in loading screen when I finished my ...
Type: System.AccessViolationException. Message: Attempted to read or write protected memory. This is often an indication that other memory ...
Read more >How I SOLVED my Fenris crashes from 1.1.1
Game unplayable. Crash instantly after 1.1.1 update following Fenris crashing ... This indirectly indicates system stability problems.
Read more >System.AccessViolationException while running Winui3 ...
Hi Team, I am getting bellow error while running WinUI3 application with WinodwsAppSDK 1.1.1 nuget package reference.
Read more >System.AccessViolationException - Microsoft Q&A
About the error: I am using C# on .NET Framework 4.8. The error is very inconsistent, it can happen within a few seconds,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Was able to resolve the issue with
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
as mentioned in https://github.com/microsoft/microsoft-ui-xaml/issues/7199#issuecomment-1148410106. Thanks!Haven’t tried to remove all previous runtimes on my computer yet. Have other projects that still need to use the preview 3 SDK.
But I still think this is a bug that needs to be resolved without any workaround, or the official document or release note should mention the runtime versions that it’s not compatible with.
Thank you, but how can i do that?
Edit: I managed to reinstall packages and here is how i did it;
Edit 2: I managed to launch app as unpackaged by adding this line to *.csproj:
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>