Page 1 of 1

AccessViolationException when clicking on user control

Posted: 17 Feb 2023, 17:01
by voula_d
I'm getting the following exception when clicking on a user control that is dynamically added to a tab item:
Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at Noesis.View.Noesis_View_MouseButtonDown(HandleRef view, Int32 x, Int32 y, Int32 button)
at NoesisApp.Window.OnDisplayMouseButtonDown(Display display, Int32 x, Int32 y, MouseButton button)
at NoesisApp.Win32Display.DispatchEvent(UInt32 msg, IntPtr wParam, IntPtr lParam)
at NoesisApp.Win32Display.WndProc(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam)
at NoesisApp.Win32Display.WinApi.DispatchMessage(Message& lpMsg)
at NoesisApp.Win32Display.EnterMessageLoop(Boolean runInBackground)
at NoesisApp.Application.Run()
I'm not sure what is causing this or how to debug it. I have no code that handles a mouse down event on my side.

Re: AccessViolationException when clicking on user control

Posted: 20 Feb 2023, 12:13
by jsantos
Are you able to reproduce this in one of our examples? If so, please, let us know the steps.

Re: AccessViolationException when clicking on user control

Posted: 22 Feb 2023, 17:16
by voula_d
I can't find an example that dynamically adds a user control and I cannot reproduce the problem in any other case. I'm adding a control to a canvas by dynamically parsing xaml. Could you point me to a possible reason why this kind of error could be thrown?

Re: AccessViolationException when clicking on user control

Posted: 23 Feb 2023, 12:00
by sfernandez
I guess this is related to your other post, could you please create a ticket in our bugtracker and share an example projet that reproduces the crash?

Re: AccessViolationException when clicking on user control

Posted: 23 Feb 2023, 17:17
by voula_d
I tried reproducing the error using a simpler sample application but unfortunately it was not reproducible. I can only reproduce it on my application which I cannot share. I can't think of any other way to point you to a reproducible scenario, I guess I have to keep trying.
I found another issue with Dispatcher.BeginInvoke however that could be related. I just posted a ticket for that
https://www.noesisengine.com/bugs/view.php?id=2522