Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Unhandled Error in DrawHandles although I do not use this method (Read 3671 times)
shanti software
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 5
Joined: Aug 24th, 2018
Unhandled Error in DrawHandles although I do not use this method
Aug 24th, 2018 at 4:44am
Print Post  
We are seeing intermittent 'Object reference not set to an instance of an object.' errors initiating from the DrawHandles method. I do not override this method so I was wondering if anyone has any clues as to what the source could be. The result is the Red cross of doom. We have only seen this cross before when users have run out of GDI objects, however the error message in these cases relates to Out of memory. Here is the call stack.


An error has occurred in DrawHandles at Line: 0
c92e983a12cf70f2fdcd13fa39d7731d7 at Line: 0 Draw at Line: 0
c85c9fb5f1477600f0b8e47a76b97a8a7 at Line: 0 Draw at Line: 0
cbdcbabce8bb735d287c1c0e3584d6497 at Line: 0 OnPaint at Line: 0 PaintWithErrorHandling at Line: 0 WmPaint at Line: 0 WndProc at Line: 0 OnMessage at Line: 0 WndProc at Line: 0 Callback at Line: 0


Object reference not set to an instance of an object.

An error has occurred in DrawHandles at Line: 0
c92e983a12cf70f2fdcd13fa39d7731d7 at Line: 0 Draw at Line: 0
c85c9fb5f1477600f0b8e47a76b97a8a7 at Line: 0 Draw at Line: 0
cbdcbabce8bb735d287c1c0e3584d6497 at Line: 0 OnPaint at Line: 0 PaintWithErrorHandling at Line: 0 WmPaint at Line: 0 WndProc at Line: 0 OnMessage at Line: 0 WndProc at Line: 0 Callback at Line: 0

Any ideas would be appreciated. Thanks.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: Unhandled Error in DrawHandles although I do not use this method
Reply #1 - Aug 24th, 2018 at 9:33am
Print Post  
For what kind of item type did that happen and what's its HandlesStyle value?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: Unhandled Error in DrawHandles although I do not use this method
Reply #2 - Aug 24th, 2018 at 3:41pm
Print Post  
E.g. looking at ShapeNode's code, you might get null reference exceptions if some members of ActiveItemHandlesStyle or SelectedItemHandlesStyle are null - such as DashPen. Could you verify all property values there and *ItemHandlesStyle objects themselves aren't null?
  
Back to top
 
IP Logged
 
shanti software
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 5
Joined: Aug 24th, 2018
Re: Unhandled Error in DrawHandles although I do not use this method
Reply #3 - Aug 27th, 2018 at 2:31am
Print Post  
I use the control to put together a tree like sequence diagram.
I generate ShapeNodes as well as the DiagramLinks between them.

I handle the Diagram_DrawNode event to custom draw all of the shape nodes (ShapeCustomDraw = MindFusion.Diagramming.CustomDraw.Additional)
There is a try catch block around all code in this event handler so we know the error is not being fired from within there.

None of the properties of the diagram have changed in over a year, yet this bug has only started occurring since our latest rollout.

All the handles styles are out of the box. RotationHandleBrush appears to be null.
I paused the code after loading the tree and checked the handle style values

? diagram1.SelectedItemHandlesStyle
{MindFusion.Diagramming.HandlesVisualStyle}
ControlPointBrush: {Solid}
DashPen: {Solid}
HandleBrush: {Solid}
HandlePen: {Solid}
HatchBrush: {Hatch}
PatternBrush: {Hatch}
RotationHandleBrush: null
c1b13e19ba06bfb790bda0ebad3a57687: null
c4c055bcc8ae241269d46451312553450: {Solid}
c4c66f5b3ad71855cdd4d04c45803cf65: {Solid}
c5cf7e840ea88ef3cc1d0f37b76ca3af9: {Solid}
c60dbcc7afaa46b1fde9056e70f0e9b26: {Hatch}
c62b7576c5532c101dda98e43fac94b09: {Solid}
c78742fd36e694a84a8512a6bc84cbab3: {Solid}
c9295fb333ca2c734bf03e5fdb03dedbc: {Hatch}
cb90a04ed593b1698d608b42851271cb2: {Solid}

? diagram1.ActiveItemHandlesStyle
{MindFusion.Diagramming.HandlesVisualStyle}
ControlPointBrush: {Solid}
DashPen: {Solid}
HandleBrush: {Solid}
HandlePen: {Solid}
HatchBrush: {Hatch}
PatternBrush: {Hatch}
RotationHandleBrush: null
c1b13e19ba06bfb790bda0ebad3a57687: null
c4c055bcc8ae241269d46451312553450: {Solid}
c4c66f5b3ad71855cdd4d04c45803cf65: {Solid}
c5cf7e840ea88ef3cc1d0f37b76ca3af9: {Solid}
c60dbcc7afaa46b1fde9056e70f0e9b26: {Hatch}
c62b7576c5532c101dda98e43fac94b09: {Solid}
c78742fd36e694a84a8512a6bc84cbab3: {Solid}
c9295fb333ca2c734bf03e5fdb03dedbc: {Hatch}
cb90a04ed593b1698d608b42851271cb2: {Solid}


Here are the properties of the diagram

diagramView1.Behavior = Behavior.DrawLinks;
diagramView1.ModificationStart = ModificationStart.AutoHandles;
diagramView1.ShowToolTips = true;

diagram1.NodesExpandable = true;
diagram1.AllowUnconnectedLinks = false;
diagram1.LinkHeadShape = ArrowHeads.BowArrow;
diagram1.LinkShape = LinkShape.Polyline;
diagram1.ShadowsStyle = ShadowsStyle.None;
diagram1.ShapeHandlesStyle = HandlesStyle.Invisible;
diagram1.LinkHandlesStyle = HandlesStyle.EasyMove;




Thank you.
« Last Edit: Aug 30th, 2018 at 11:27pm by shanti software »  
Back to top
 
IP Logged
 
shanti software
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 5
Joined: Aug 24th, 2018
Re: Unhandled Error in DrawHandles although I do not use this method
Reply #4 - Sep 4th, 2018 at 2:03am
Print Post  
Do you guys have any more clues for me please?

Irrespective of what settings the control has, it shouldn't
result in an untrapped object reference error, red cross of doom, and no way for me to recover other than re-loading a fresh instance of the control. We've got users who've been putting up with this for 2 weeks now and I need a workaround at least.

Thanks
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: Unhandled Error in DrawHandles although I do not use this method
Reply #5 - Sep 4th, 2018 at 8:15am
Print Post  
Sorry, I've missed your post. Please post full stack trace showing the type of objects called, e.g. it looks like this in my test -

Code
Select All
>	ApiTester.exe!ApiTester.MainForm.diagram_DrawNode(object sender = {MindFusion.Diagramming.Diagram}, MindFusion.Diagramming.DrawNodeEventArgs e = {MindFusion.Diagramming.DrawNodeEventArgs}) Line 5178	C#
 	MindFusion.Diagramming.dll!MindFusion.Diagramming.DiagramBase.OnDrawNode(MindFusion.Diagramming.DrawNodeEventArgs e = {MindFusion.Diagramming.DrawNodeEventArgs}) + 0x99 bytes
 	MindFusion.Diagramming.dll!MindFusion.Diagramming.DiagramBase.c2170f1240e144e3a321b7ac95a61cffc(MindFusion.Diagramming.DrawNodeEventArgs ccccb5c615104a5178972fa16c8a01650 = {MindFusion.Diagramming.DrawNodeEventArgs}) + 0xc4 bytes
 	MindFusion.Diagramming.dll!MindFusion.Diagramming.Diagram.c2170f1240e144e3a321b7ac95a61cffc(MindFusion.Drawing.IGraphics c6c92d7b0a001e45905428290158c2b17 = {MindFusion.Drawing.GdiGraphics}, MindFusion.Diagramming.DiagramNode cf97bac6b0d408303acc822ab78fc1a19 = {MindFusion.Diagramming.ShapeNode}, bool c9ad6e71c98bc3301de210ef60cbebaf6 = true, System.Drawing.RectangleF c890ffd49e808b04095f06b4eb842e073 = {X = 1.0 Y = 1.0 Width = 42.33333 Height = 38.629158}) + 0x99 bytes
 	... 



We don't see how catching and ignoring null-reference exceptions instead of fixing underlying logic error is a good idea. If you really want that, you can override DiagramView.OnPaint and call base method within a try / catch.

Regards,
Slavcho
  
Back to top
 
IP Logged
 
shanti software
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 5
Joined: Aug 24th, 2018
Re: Unhandled Error in DrawHandles although I do not use this method
Reply #6 - Sep 5th, 2018 at 3:24am
Print Post  
Thanks for your response - much appreciated.

Agreed that we're better off finding and fixing the underlying problem. What we've seen is that once the error occurs, the diagram components will not recover when you attempt to reload another diagram. (Red Cross remains).

For now we've rolled out a workaround where the user can click a 'refresh' which actually reloads a fresh instance of the diagram and diagramview components, so the user can overcome the issue without having to restart the application.

The error occurs about once a day for the main users. You can load up the same data / diagram with a fresh instance of the diagram component, without any issues
-> it is hard for us to reproduce in testing.

The trace in my first post is the extent of what we log, and I assume the amount of info is reduced because it's coming from the app running in release mode.

If I can reproduce this in debug mode I will repost the resulting call stack, which will hopefully provide more info.

Thank you.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: Unhandled Error in DrawHandles although I do not use this method
Reply #7 - Sep 5th, 2018 at 8:00am
Print Post  
Quote:
None of the properties of the diagram have changed in over a year, yet this bug has only started occurring since our latest rollout.


Could you share what else changed in latest rollout? Like moving to a new .NET version, moving to a new diagramming.dll version, adding new components to the application?
  
Back to top
 
IP Logged
 
shanti software
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 5
Joined: Aug 24th, 2018
Re: Unhandled Error in DrawHandles although I do not use this method
Reply #8 - Sep 11th, 2018 at 2:51pm
Print Post  
I've trawled through all of the change logs and there are no property changes to the diagram control. Neither have we changed any of our project references.
We are trying to improve on our captured stack trace so that I can provide you with more information.

Thanks for your efforts so far.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint