View Issue Details

IDProjectCategoryView StatusLast Update
0003249NoesisGUIUnity3Dpublic2024-06-13 17:55
ReporterXaron Assigned Tosfernandez  
PrioritynormalSeveritycrashReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.2.3 
Target Version3.2.4Fixed in Version3.2.4 
Summary0003249: Noesis crashes Unity
DescriptionWe get a native crash with Noesis 3.2.3 within Unity 2022.3.22f1:

What we're doing:
We have an enum that contains values to differentiate between icons displayed on map after calling mouse click
but in our code we're trying to assign a null value to a variable of this enum type.
It causes the crash in the VisualTreeHelper class of noesis

NullReferenceException: Object reference not set to an instance of an object
  at SeapowerUI.ViewModels.MissionEditorViewModel+<>c__DisplayClass171_0.<AddGroup>b__0 (SeaPower.GeoPosition mousePosition) [0x002a3] in E:\Git\seapower_pf\Assets\Scripts\UI\Main Menu\ViewModels\MissionEditorViewModel.cs:1386
  at SeapowerUI.ViewModels.MissionEditorMapViewModel+PlaceGroup.MouseAction (System.Object v, Noesis.RoutedEventArgs args, SeaPower.GeoPosition mousePosition, System.Boolean& handled) [0x0001c] in E:\Git\seapower_pf\Assets\Scripts\UI\Main Menu\ViewModels\MissionEditorMapViewModel.cs:74
  at SeapowerUI.ViewModels.InteractionStateBroker+<>c__DisplayClass19_0.<HandledEvent>b__1 (Noesis.HitTestResult hit) [0x00008] in E:\Git\seapower_pf\Assets\Scripts\UI\Game\ViewModels\InteractionStateBroker.cs:218
  at Noesis.VisualTreeHelper.OnHitTestResult (System.IntPtr hitPtr) [0x00002] in .\Packages\NoesisGUI\Runtime\API\Proxies\VisualTreeHelper.cs:95
UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
NoesisUnity:OnUnhandledException(Exception) (at .\Packages\NoesisGUI\Runtime\NoesisUnity.cs:390)
Noesis.Error:UnhandledException(Exception) (at .\Packages\NoesisGUI\Runtime\API\Core\Error.cs:18)
Noesis.VisualTreeHelper:OnHitTestResult(IntPtr) (at .\Packages\NoesisGUI\Runtime\API\Proxies\VisualTreeHelper.cs:99)
Noesis.VisualTreeHelper:VisualTreeHelper_HitTestCallback(HandleRef, Point&, Callback_HitTestFilter, Callback_HitTestResult)
Noesis.VisualTreeHelper:HitTestCallbackHelper(Visual, Point, Callback_HitTestFilter, Callback_HitTestResult) (at .\Packages\NoesisGUI\Runtime\API\Proxies\VisualTreeHelper.cs:126)
Noesis.VisualTreeHelper:HitTest(Visual, HitTestFilterCallback, HitTestResultCallback, HitTestParameters) (at .\Packages\NoesisGUI\Runtime\API\Proxies\VisualTreeHelper.cs:53)
SeapowerUI.ViewModels.InteractionStateBroker:HandledEvent(Point, RoutedEventArgs) (at Assets\Scripts\UI\Game\ViewModels\InteractionStateBroker.cs:212)
SeapowerUI.ViewModels.InteractionStateBroker:MouseEvent(Object, MouseEventArgs) (at Assets\Scripts\UI\Game\ViewModels\InteractionStateBroker.cs:254)
Noesis.MouseButtonEventArgs:InvokeHandler(Delegate, IntPtr, IntPtr) (at .\Packages\NoesisGUI\Runtime\API\Proxies\MouseButtonEventArgs.cs:50)
Noesis.EventManager:InvokeHandler(IntPtr, Delegate, IntPtr, IntPtr) (at .\Packages\NoesisGUI\Runtime\API\Core\Events.cs:572)
Noesis.EventHandlerStore:RaiseRoutedEvent(IntPtr, IntPtr, IntPtr, IntPtr, IntPtr) (at .\Packages\NoesisGUI\Runtime\API\Core\Events.cs:267)
Noesis.View:Noesis_View_MouseButtonDown(HandleRef, Int32, Int32, Int32)
Noesis.View:MouseButtonDown(Int32, Int32, MouseButton) (at .\Packages\NoesisGUI\Runtime\API\Core\View.cs:214)
NoesisView:ProcessEvent(Event, Boolean, Boolean) (at .\Packages\NoesisGUI\Runtime\NoesisView.cs:1743)
NoesisView:OnGUI() (at .\Packages\NoesisGUI\Runtime\NoesisView.cs:1863)

(Filename: ./Packages/NoesisGUI/Runtime/NoesisUnity.cs Line: 390)

=================================================================
    Native Crash Reporting
=================================================================
Got a UNKNOWN while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================

=================================================================
    Managed Stacktrace:
=================================================================
      at <unknown> <0xffffffff>
      at Noesis.NoesisGUI_PINVOKE:DrawingContext_DrawGeometry <0x00159>
      at Noesis.DrawingContext:DrawGeometry <0x001e2>
      at MapControl.MapPolyline:OnRender <0x00162>
      at Noesis.Extend:UIElementRender <0x00251>
      at Noesis.Extend:UIElementRender <0x00152>
      at <unknown> <0xffffffff>
      at Noesis.View:Noesis_View_Update <0x0010c>
      at Noesis.View:Update <0x00192>
      at NoesisView:UpdateInternal <0x0062a>
      at NoesisView:LateUpdate <0x000da>
      at System.Object:runtime_invoke_void__this__ <0x00187>
=================================================================
Received signal SIGSEGV
Obtained 47 stack frames
0x00007ff92cee1366 (Noesis) RoutedEventArgs_RoutedEvent_get
0x00000217214af5ba (Mono JIT Code) (wrapper managed-to-native) Noesis.NoesisGUI_PINVOKE:DrawingContext_DrawGeometry (System.Runtime.InteropServices.HandleRef,System.Runtime.InteropServices.HandleRef,System.Runtime.InteropServices.HandleRef,System.Runtime.InteropServices.HandleRef)
0x00000217214af0d3 (Mono JIT Code) Noesis.DrawingContext:DrawGeometry (Noesis.Brush,Noesis.Pen,Noesis.Geometry) (at ./Packages/NoesisGUI/Runtime/API/Proxies/DrawingContext.cs:55)
0x00000217215311c3 (Mono JIT Code) MapControl.MapPolyline:OnRender (Noesis.DrawingContext) (at E:/Git/seapower_pf/Assets/Scripts/Noesis/Components/Controls/Map/MapPolyline.cs:123)
0x0000021721498562 (Mono JIT Code) Noesis.Extend:UIElementRender (intptr,intptr,intptr,Noesis.UIElement/RenderBaseCallback) (at ./Packages/NoesisGUI/Runtime/API/Core/Extend.cs:2217)
0x00000216f168ef83 (Mono JIT Code) (wrapper native-to-managed) Noesis.Extend:UIElementRender (intptr,intptr,intptr,Noesis.UIElement/RenderBaseCallback)
0x00007ff92cffa017 (Noesis) Noesis_RenderDevice_SetRenderTarget
0x00007ff92ceb7dbf (Noesis) Boxed_Thickness_GetStaticType
0x00007ff92cf0d32a (Noesis) QueryContinueDragEventArgs_GetKeyStatesHelper
0x00007ff92cff9ed8 (Noesis) Noesis_RenderDevice_SetRenderTarget
0x00007ff92cf0dc1e (Noesis) QueryContinueDragEventArgs_GetKeyStatesHelper
0x00007ff92cf0d32a (Noesis) QueryContinueDragEventArgs_GetKeyStatesHelper
0x00007ff92cff9ed8 (Noesis) Noesis_RenderDevice_SetRenderTarget
0x00007ff92cfc4cfe (Noesis) Boxed_Point_GetStaticType
0x00007ff92cfc5a2e (Noesis) Boxed_Point_GetStaticType
0x00007ff92cfc403c (Noesis) Boxed_Point_GetStaticType
0x00007ff92cf0d32a (Noesis) QueryContinueDragEventArgs_GetKeyStatesHelper
0x00007ff92cff9ed8 (Noesis) Noesis_RenderDevice_SetRenderTarget
0x00007ff92d008669 (Noesis) DataObjectEventArgs_IsDragDrop_get
0x00007ff92d0084cb (Noesis) DataObjectEventArgs_IsDragDrop_get
0x00007ff92d006b53 (Noesis) Noesis_RenderDevice_SetRenderTarget
0x000002171c6dedfd (Mono JIT Code) (wrapper managed-to-native) Noesis.View:Noesis_View_Update (System.Runtime.InteropServices.HandleRef,double)
0x000002171c6d81b3 (Mono JIT Code) Noesis.View:Update (double) (at ./Packages/NoesisGUI/Runtime/API/Core/View.cs:379)
0x000002171c6d1fbb (Mono JIT Code) NoesisView:UpdateInternal () (at ./Packages/NoesisGUI/Runtime/NoesisView.cs:1508)
0x000002171c6d18eb (Mono JIT Code) NoesisView:LateUpdate () (at ./Packages/NoesisGUI/Runtime/NoesisView.cs:1409)
0x00000215fa4038a8 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
0x00007ff9031b4c1e (mono-2.0-bdwgc) mono_jit_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/mini/mini-runtime.c:3445)
0x00007ff9030ed254 (mono-2.0-bdwgc) do_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:3068)
0x00007ff9030ed3cc (mono-2.0-bdwgc) mono_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:3115)
0x00007ff72e030c44 (Unity) scripting_method_invoke
0x00007ff72e00e9b4 (Unity) ScriptingInvocation::Invoke
0x00007ff72dff61a4 (Unity) MonoBehaviour::CallMethodIfAvailable
0x00007ff72dff62ca (Unity) MonoBehaviour::CallUpdateMethod
0x00007ff72da8963b (Unity) BaseBehaviourManager::CommonUpdate<LateBehaviourManager>
0x00007ff72da90a0a (Unity) LateBehaviourManager::Update
0x00007ff72dcc570d (Unity) `InitPlayerLoopCallbacks'::`2'::PreLateUpdateScriptRunBehaviourLateUpdateRegistrator::Forward
0x00007ff72dca4a3c (Unity) ExecutePlayerLoop
0x00007ff72dca4bb0 (Unity) ExecutePlayerLoop
0x00007ff72dcab445 (Unity) PlayerLoop
0x00007ff72ec789ef (Unity) PlayerLoopController::InternalUpdateScene
0x00007ff72ec8581d (Unity) PlayerLoopController::UpdateSceneIfNeededFromMainLoop
0x00007ff72ec83b01 (Unity) Application::TickTimer
0x00007ff72f0fe67a (Unity) MainMessageLoop
0x00007ff72f103550 (Unity) WinMain
0x00007ff7304e594e (Unity) __scrt_common_main_seh
0x00007ff96eea7344 (KERNEL32) BaseThreadInitThunk
0x00007ff9707426b1 (ntdll) RtlUserThreadStart
TagsNo tags attached.
PlatformWindows

Activities

Xaron

Xaron

2024-04-18 15:33

reporter  

sfernandez

sfernandez

2024-04-19 10:38

manager   ~0009388

Last edited: 2024-04-19 10:39

It seems DrawingContext.DrawGeometry is not checking if the passed geometry is null, we will fix it.
In the meantime the easy workaround is that you wrap that call in MapPolyline.OnRender with if (geometry != null), could you try that?
sfernandez

sfernandez

2024-04-19 17:16

manager   ~0009390

It's been fixed for upcoming 3.2.4 version.
Please find a patched library here so you can try: https://drive.google.com/file/d/1WfQFLnwibWD39c5cDU5y3CuoWj7zXeYO/view?usp=sharing

Issue History

Date Modified Username Field Change
2024-04-18 15:33 Xaron New Issue
2024-04-18 15:33 Xaron File Added: Crash_2024-04-17_065415188.zip
2024-04-18 15:58 Xaron Description Updated
2024-04-19 10:31 sfernandez Assigned To => sfernandez
2024-04-19 10:31 sfernandez Status new => assigned
2024-04-19 10:31 sfernandez Target Version => 3.2.4
2024-04-19 10:38 sfernandez Status assigned => feedback
2024-04-19 10:38 sfernandez Note Added: 0009388
2024-04-19 10:39 sfernandez Note Edited: 0009388
2024-04-19 17:16 sfernandez Note Added: 0009390
2024-06-13 17:55 sfernandez Status feedback => resolved
2024-06-13 17:55 sfernandez Resolution open => fixed
2024-06-13 17:55 sfernandez Fixed in Version => 3.2.4