Using Grasshopper in RhinoInside.Revit, opening and editing a C# Scripting component causes Revit to crash (and take Rhino & GH with it)
I’ve replicated this error a few times on mine and a colleague’s computer. Once a user starts typing in new code, the program starts lagging and shuts down completely within 5-10 seconds.
Setting the scripting component to Python 3.0 does not result in any problems.
The C# scripting component works without issue when Rhino is opened by itself without Revit.
Revit 2024.1, Rhino 8.0.23304.0900, GH1.0.0007
I am happy to provide any additional information that might be needed to review this problem
Additonally, this behavior sometimes happens with Python 3.0, but rarely.
All the Python 3.0 crashes happened while I was using the RevitAPI, although I am not sure this is the cause.
Investigate this a bit and seems like there are a couple of conflicts with the WebView control that we are usings when run on Revit which is .NetFramework.
I’ll dig deeper into this to see if I can find where the error happens
[ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object.
at System.Object.GetType()
at Microsoft.Web.WebView2.Core.CoreWebView2PrivateHostObjectHelper.RawHelper.<>c__DisplayClass10_0.<SetAsyncMethodContinuation>b__0()
at System.Runtime.CompilerServices.TaskAwaiter.<>c__DisplayClass11_0.<OutputWaitEtwEvents>b__0()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.Tasks.AwaitTaskContinuation.RunCallback(ContextCallback callback, Object state, Task& currentTask)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
[END ERROR]
In desktop there is error file “RhinoDotNetCrash”:
[ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object.
at System.Object.GetType()
at Microsoft.Web.WebView2.Core.CoreWebView2PrivateHostObjectHelper.RawHelper.<>c__DisplayClass10_0.<SetAsyncMethodContinuation>b__0()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.Tasks.AwaitTaskContinuation.RunCallback(ContextCallback callback, Object state, Task& currentTask)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
[END ERROR]
I see, what @eirannejad create a ticked for it, but I don’t see how to fix it