question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Crash when running on Windows 11 on ARM

See original GitHub issue

Describe the bug

An unhandled exception of type ‘System.AccessViolationException’ occurred in Avalonia.Win32.dll Attempted to read or write protected memory. This is often an indication that other memory is corrupt

To Reproduce

Run new Avalonia app from template on Windows 11 on ARM

Expected behavior

No crash

Screenshots

image

Desktop (please complete the following information):

  • OS: Windows 11 on ARM
  • Version 0.10.x

Additional context

Running inside VM MacOS M1 Parallels

Disabling WindowsUIComposition avoids crash.

new Win32PlatformOptions() {  UseWindowsUIComposition = false }

https://github.com/AvaloniaUI/Avalonia/blob/1eead138fc649dcc2a2bd77148e91b2ea01f2b4f/src/Windows/Avalonia.Win32/WinRT/winrt.idl#L445-L446

https://github.com/dotnet/runtime/issues/72321

[External Code] 
> dcomp.dll!Microsoft::WRL::Details::DelegateArgTraits<long (__cdecl Windows::Foundation::IAsyncActionCompletedHandler::*)(Windows::Foundation::IAsyncAction *,enum ABI::Windows::Foundation::AsyncStatus)>::DelegateInvokeHelper<Microsoft::WRL::Implements<Microsoft::WRL::RuntimeClassFlags<2>,Windows::Foundation::IAsyncActionCompletedHandler,Microsoft::WRL::FtmBase>,<lambda_2a41ea20f21462c29868894764bbafd5>,-1,Windows::Foundation::IAsyncAction *,enum ABI::Windows::Foundation::AsyncStatus>::Invoke() Unknown
  dcomp.dll!Microsoft::WRL::InvokeTraits<-2>::InvokeDelegates<<lambda_235ffb6b1ffc6a4928642e92ab1f25a5>,Windows::Foundation::IAsyncActionCompletedHandler>() Unknown
  dcomp.dll!<lambda>(void)() Unknown
  dcomp.dll!Microsoft::WRL2::ContextSession::LeaveSession_Callback<<lambda>(void)>() Unknown
  dcomp.dll!Windows::UI::Composition::CompositorCommon::OnCommitCompletion(void) Unknown
  CoreMessaging.dll!CFlat::SehSafe::Execute<<lambda_19cca5ef35227df66cdfebe4b6644b4b>>() Unknown
  CoreMessaging.dll!Microsoft::CoreUI::Dispatch::WaitCallback::ImportAdapter$() Unknown
  CoreMessaging.dll!Microsoft::CoreUI::Dispatch::RegisteredWait::DoCallback() Unknown
  CoreMessaging.dll!Microsoft::CoreUI::Dispatch::DeferredCall::Callback_Dispatch() Unknown
  CoreMessaging.dll!Microsoft::CoreUI::Dispatch::DeferredCallDispatcher::Callback_OnDispatch() Unknown
  CoreMessaging.dll!Microsoft::CoreUI::Dispatch::EventLoop::Callback_RunCoreLoop() Unknown
  CoreMessaging.dll!Microsoft::CoreUI::Dispatch::UserAdapter::DrainCoreMessagingQueue(enum Microsoft::CoreUI::Dispatch::UserAdapter$UserPriority,void * *) Unknown
  CoreMessaging.dll!Microsoft::CoreUI::Dispatch::UserAdapter::OnUserDispatch(bool,enum Microsoft::CoreUI::Dispatch::UserAdapter$UserPriority,void * *) Unknown
  CoreMessaging.dll!Microsoft::CoreUI::Dispatch::UserAdapter::OnUserDispatchRaw(enum Microsoft::CoreUI::Dispatch::UserAdapter$UserPriority,bool,void * *) Unknown
  CoreMessaging.dll!Microsoft::CoreUI::Dispatch::UserAdapter::DoWork(struct HWND__ *,enum Microsoft::CoreUI::Dispatch::UserAdapter$UserPriority,bool) Unknown
  CoreMessaging.dll!Microsoft::CoreUI::Dispatch::UserAdapter::WindowProc(struct HWND__ *,unsigned int,unsigned __int64,__int64) Unknown
  user32.dll!UserCallWinProcCheckWow(struct _ACTIVATION_CONTEXT *,__int64 (*)(struct tagWND *,unsigned int,unsigned int64,__int64),struct HWND *,enum _WM_VALUE,unsigned __int64,__int64,void *,int) Unknown
  user32.dll!DispatchClientMessage() Unknown
  user32.dll!__fnDWORD () Unknown
  ntdll.dll!KiUserCallbackDispatcherReturn () Unknown
  win32u.dll!NtUserGetMessage () Unknown
  user32.dll!GetMessageW() Unknown
  [External Code] 
  kernel32.dll!BaseThreadInitThunk() Unknown
  ntdll.dll!RtlUserThreadStart() Unknown
[Managed to Native Transition]
Avalonia.Win32.dll!Avalonia.Win32.WinRT.Impl.__MicroComICompositionGraphicsDeviceProxy.CreateDrawingSurface(Avalonia.Win32.Interop.UnmanagedMethods.SIZE sizePixels, Avalonia.Win32.WinRT.DirectXPixelFormat pixelFormat, Avalonia.Win32.WinRT.DirectXAlphaMode alphaMode)
Avalonia.Win32.dll!Avalonia.Win32.WinRT.Composition.WinUICompositorConnection.CreateWindow(nint hWnd)
Avalonia.Win32.dll!Avalonia.Win32.WinRT.Composition.WinUiCompositedWindowSurface.CreateGlRenderTarget()
Avalonia.Skia.dll!Avalonia.Skia.GlRenderTarget.GlRenderTarget(SkiaSharp.GRContext grContext, Avalonia.OpenGL.Surfaces.IGlPlatformSurface glSurface)
Avalonia.Skia.dll!Avalonia.Skia.GlSkiaGpu.TryCreateRenderTarget(System.Collections.Generic.IEnumerable<object> surfaces)
Avalonia.Skia.dll!Avalonia.Skia.PlatformRenderInterface.CreateRenderTarget(System.Collections.Generic.IEnumerable<object> surfaces)
Avalonia.Controls.dll!Avalonia.Controls.TopLevel.CreateRenderTarget()
Avalonia.Controls.dll!Avalonia.Controls.TopLevel.Avalonia.Rendering.IRenderRoot.CreateRenderTarget()
Avalonia.Base.dll!Avalonia.Rendering.Composition.Server.ServerCompositionTarget.Render()
Avalonia.Base.dll!Avalonia.Rendering.Composition.Server.ServerCompositor.RenderCore()
Avalonia.Base.dll!Avalonia.Rendering.Composition.Server.ServerCompositor.Render()
Avalonia.Base.dll!Avalonia.Rendering.RenderLoop.TimerTick(System.TimeSpan time)
Avalonia.Win32.dll!Avalonia.Win32.WinRT.Composition.WinUICompositorConnection.RunLoopHandler.Invoke(Avalonia.Win32.WinRT.IAsyncAction asyncInfo, Avalonia.Win32.WinRT.AsyncStatus asyncStatus)
Avalonia.Win32.dll!Avalonia.Win32.WinRT.Impl.__MicroComIAsyncActionCompletedHandlerVTable.Invoke(void* this, void* asyncInfo, Avalonia.Win32.WinRT.AsyncStatus asyncStatus)
[Native to Managed Transition]
dcomp.dll!Microsoft::WRL::Details::DelegateArgTraits<long (__cdecl Windows::Foundation::IAsyncActionCompletedHandler::*)(Windows::Foundation::IAsyncAction *,enum ABI::Windows::Foundation::AsyncStatus)>::DelegateInvokeHelper<Microsoft::WRL::Implements<Microsoft::WRL::RuntimeClassFlags<2>,Windows::Foundation::IAsyncActionCompletedHandler,Microsoft::WRL::FtmBase>,<lambda_2a41ea20f21462c29868894764bbafd5>,-1,Windows::Foundation::IAsyncAction *,enum ABI::Windows::Foundation::AsyncStatus>::Invoke()
dcomp.dll!Microsoft::WRL::InvokeTraits<-2>::InvokeDelegates<<lambda_235ffb6b1ffc6a4928642e92ab1f25a5>,Windows::Foundation::IAsyncActionCompletedHandler>()
dcomp.dll!<lambda>(void)()
dcomp.dll!Microsoft::WRL2::ContextSession::LeaveSession_Callback<<lambda>(void)>()
dcomp.dll!Windows::UI::Composition::CompositorCommon::OnCommitCompletion(void)
CoreMessaging.dll!CFlat::SehSafe::Execute<<lambda_19cca5ef35227df66cdfebe4b6644b4b>>()
CoreMessaging.dll!Microsoft::CoreUI::Dispatch::WaitCallback::ImportAdapter$()
CoreMessaging.dll!Microsoft::CoreUI::Dispatch::RegisteredWait::DoCallback()
CoreMessaging.dll!Microsoft::CoreUI::Dispatch::DeferredCall::Callback_Dispatch()
CoreMessaging.dll!Microsoft::CoreUI::Dispatch::DeferredCallDispatcher::Callback_OnDispatch()
CoreMessaging.dll!Microsoft::CoreUI::Dispatch::EventLoop::Callback_RunCoreLoop()
CoreMessaging.dll!Microsoft::CoreUI::Dispatch::UserAdapter::DrainCoreMessagingQueue(enum Microsoft::CoreUI::Dispatch::UserAdapter$UserPriority,void * *)
CoreMessaging.dll!Microsoft::CoreUI::Dispatch::UserAdapter::OnUserDispatch(bool,enum Microsoft::CoreUI::Dispatch::UserAdapter$UserPriority,void * *)
CoreMessaging.dll!Microsoft::CoreUI::Dispatch::UserAdapter::OnUserDispatchRaw(enum Microsoft::CoreUI::Dispatch::UserAdapter$UserPriority,bool,void * *)
CoreMessaging.dll!Microsoft::CoreUI::Dispatch::UserAdapter::DoWork(struct HWND__ *,enum Microsoft::CoreUI::Dispatch::UserAdapter$UserPriority,bool)
CoreMessaging.dll!Microsoft::CoreUI::Dispatch::UserAdapter::WindowProc(struct HWND__ *,unsigned int,unsigned __int64,__int64)
user32.dll!UserCallWinProcCheckWow(struct _ACTIVATION_CONTEXT *,__int64 (*)(struct tagWND *,unsigned int,unsigned int64,__int64),struct HWND *,enum _WM_VALUE,unsigned __int64,__int64,void *,int)
user32.dll!DispatchClientMessage()
user32.dll!__fnDWORD ()
ntdll.dll!KiUserCallbackDispatcherReturn ()
win32u.dll!NtUserGetMessage ()
user32.dll!GetMessageW()
[Managed to Native Transition]
Avalonia.Win32.dll!Avalonia.Win32.WinRT.Composition.WinUICompositorConnection.RunLoop()
Avalonia.Win32.dll!Avalonia.Win32.WinRT.Composition.WinUICompositorConnection.TryCreateAndRegisterCore.AnonymousMethod__0()
[Native to Managed Transition]
kernel32.dll!BaseThreadInitThunk()
ntdll.dll!RtlUserThreadStart()

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:16 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
maxkatz6commented, Nov 3, 2022

@Lakritzator my apologies, I pinged a wrong person.

@olifink thank you testing these changes. If you will find anything else, please let me know.

0reactions
wieslawsoltescommented, Nov 9, 2022

@wieslawsoltes same results with the final release of net 7.0 - empty window on a real Windows Arm machine. It seems very likely that mac Parallels replaces/redirects the display driver/compositor to macOS native/metal, so the behavior in rendering is different on Windows Arm hardware than on emulation

Also, when I try the original workaround you described with UseWindowsUIComposition = false I get a completely black window, same as any other Avalonia based app I try to run (Lunacy, dotMemory, dotTrace)

image

Try disabling GPU rendering and other thing to try Direct2D1 backend

Read more comments on GitHub >

github_iconTop Results From Across the Web

Teams Crash on Windows 11 ARM64
Was able to deploy Windows 11 ARM64 and install Teams without issue. I've performed chkdsk /f /r with no success on failing VM....
Read more >
Program Compatibility Troubleshooter on Arm
On ARM, a section titled Windows 10 on ARM or Windows 11 on ARM will be available in the Compatibility tab. Click Change...
Read more >
Windows 11 Keeps Crashing? Try These Methods
Windows 11 Keeps Crashing? Try These Methods · 1. Check for System Updates · 2. Update Your Device Drivers · 3. Remove Recently...
Read more >
Windows 11 ARM - Visual studio IIS Express crash
My app builds, but trying to view it locally in the browser results in a 503 and the app pool crashes with the...
Read more >
Crash on new game start(Windows 11 on ARM) :: Kenshi ...
I'm using new macbook on m1 and trying to get this game working in parallels Win11 on ARM. Main menu is working fine,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found