Additional PhotinoWindow instances can't be created from a detached event thread.
On macOS and Linux it is enough to set the _manageThreadId of the new window to the parent's managed thread ID instead of the Environment.CurrentManagedThreadId:
Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Repeat 2 times:
--------------------------------
at PhotinoNET.PhotinoWindow.Photino_Invoke(IntPtr, PhotinoNET.InvokeCallback)
--------------------------------
at PhotinoNET.PhotinoWindow.Invoke(System.Action)
at PhotinoNET.PhotinoWindow.WaitForClose()
at CODE.Transcriber.OpenConfigurationActionHandler+<HandleAsync>d__4.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef)
at CODE.Transcriber.OpenConfigurationActionHandler.HandleAsync(CODE.Transcriber.OpenConfigurationActionRequest)
at CODE.Transcriber.ActionHandler`1+<InvokeAsync>d__6[[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef)
at CODE.Transcriber.ActionHandler`1[[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].InvokeAsync(System.String)
at System.RuntimeMethodHandle.InvokeMethod(System.Object, Void**, System.Signature, Boolean)
at System.Reflection.MethodInvoker.Invoke(System.Object, IntPtr*, System.Reflection.BindingFlags)
at System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
at CODE.Transcriber.ActionRouter+<>c__DisplayClass5_0.<InvokeRequestHandler>b__0()
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(System.Threading.Thread, System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef, System.Threading.Thread)
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart()
We need to check if there is some way to create new windows from the main thread in some unified way across all operating systems.
Additional PhotinoWindow instances can't be created from a detached event thread.
On macOS and Linux it is enough to set the
_manageThreadId
of the new window to the parent's managed thread ID instead of theEnvironment.CurrentManagedThreadId
:On Windows it crashes with the following message:
We need to check if there is some way to create new windows from the main thread in some unified way across all operating systems.