MainFrame NullReferenceException
dsn27 opened this issue · 1 comments
dsn27 commented
After opening several STEP files and changing the Projection Direction the following error can sometimes occur.
Line 571: MainFrame is null
System.NullReferenceException
HResult=0x80004003
Message=Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
Source=CADability
StackTrace:
at CADability.ProjectedModel.RecalcAll(Boolean temporary) in C:\Development\Repos\SOFAgh\CADability\CADability\ProjectedModel.cs:line 571
CADability.dll!CADability.ProjectedModel.RecalcAll(bool temporary) Line 571 C#
CADability.dll!CADability.ProjectedModel.ForceRecalc() Line 249 C#
CADability.dll!CADability.ModelView.ForceInvalidateAll() Line 659 C#
CADability.dll!CADability.ModelView.SetViewDirection(CADability.ModOp project, CADability.GeoPoint fixPoint, bool mouseIsDown) Line 1854 C#
CADability.dll!CADability.Actions.ViewPointAction.OnMouseMove(CADability.Substitutes.MouseEventArgs e, CADability.IView vw) Line 107 C#
CADability.dll!CADability.ActionStack.OnMouseMove(CADability.Substitutes.MouseEventArgs e, CADability.IView View) Line 309 C#
CADability.dll!CADability.ModelView.CADability.IView.OnMouseMove(CADability.Substitutes.MouseEventArgs eIn) Line 1115 C#
CADability.Forms.dll!CADability.Forms.CadCanvas.OnMouseMove(System.Windows.Forms.MouseEventArgs e) Line 245 C#
System.Windows.Forms.dll!System.Windows.Forms.Control.WmMouseMove(ref System.Windows.Forms.Message m) Unknown
System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m) Unknown
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.OnMessage(ref System.Windows.Forms.Message m) Unknown
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m) Unknown
System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(System.IntPtr hWnd, int msg, System.IntPtr wparam, System.IntPtr lparam) Unknown
[Native to Managed Transition]
[Managed to Native Transition]
System.Windows.Forms.dll!System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(System.IntPtr dwComponentID, int reason, int pvLoopData) Unknown
System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(int reason, System.Windows.Forms.ApplicationContext context) Unknown
System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoop(int reason, System.Windows.Forms.ApplicationContext context) Unknown
System.Windows.Forms.dll!System.Windows.Forms.Application.Run(System.Windows.Forms.Form mainForm) Unknown
CADability.App.exe!CADability.App.Program.Main(string[] args) Line 21 C#
SOFAgh commented
Probably fixed with this line:
if (FrameImpl.MainFrame != null && FrameImpl.MainFrame.ActiveView != null && FrameImpl.MainFrame.ActiveView.Canvas != null)
FrameImpl.MainFrame.ActiveView.Canvas.Cursor = "WaitCursor";