Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) OverflowException (Read 6161 times)
ampersand
Junior Member
**
Offline



Posts: 55
Joined: Sep 21st, 2006
OverflowException
Oct 27th, 2006 at 10:44am
Print Post  
Hi,
from time to time I get an oveflow exception. It appears sometimes (not always) when I start my app, click on the toolbutton to create a Box and start drawing the box on the flowchart.

here's the excpetion details:
Quote:
System.OverflowException was unhandled
  Message="Overflow error."
  Source="System.Drawing"
  StackTrace:
      at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
      at System.Drawing.Graphics.FillRectangle(Brush brush, Single x, Single y, Single width, Single height)
      at System.Drawing.Graphics.FillRectangle(Brush brush, RectangleF rect)
      at MindFusion.FlowChartX.Box.Draw(Graphics g, Boolean shadow)
      at MindFusion.FlowChartX.FlowChart.xbb6158772b674179(Graphics x4b101060f4767186, ChartObject xa59bff7708de3a18, Boolean x79ee3f6bdf75f984)
      at MindFusion.FlowChartX.FlowChart.OnMouseMove(MouseEventArgs e)
      at System.Windows.Forms.Control.WmMouseMove(Message& m)
      at System.Windows.Forms.Control.WndProc(Message& m)
      at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
      at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
      at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
      at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
      at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNat
iveMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
      at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
      at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
      at System.Windows.Forms.Application.Run(Form mainForm)
      at ChartTest.Program.Main() in D:\PRG\ChartTest\ChartTest\Program.cs:line 17
      at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
      at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
      at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
      at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
      at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
      at System.Threading.ThreadHelper.ThreadStart()


and here's the code of my CreateBox

Code
Select All
private void ErstelleBox()
{

btChart.BoxStyle = BoxStyle.Rectangle;
btChart.PolyTextLayout = true;
btChart.EnableStyledText = false;
btChart.BoxText = "Text durch Doppelklick ändern";
btChart.Behavior = BehaviorType.CreateBox;
btChart.Cursor = Cursors.Cross;
}

private void btChart_InitializeBox(object sender, BoxEventArgs e)
{
e.Box.FrameColor = defaultLineColor;
e.Box.FillColor = defaultFillColor;
e.Box.Pen.Width = defaultLineWeight;
e.Box.Pen.DashStyle = defaultLinePattern;
e.Box.TextColor = defaultFontColor;
e.Box.Font = new Font(GetDefaultFontFamily(), GetDefaultFontSize(), GraphicsUnit.World);
e.Box.ShadowColor = Color.Empty;
e.Box.HandlesStyle = HandlesStyle.HatchHandles3;
}
 



Do you have any idea what is going wrong? If you need more details/code give me a hint.

Dirk
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: OverflowException
Reply #1 - Oct 27th, 2006 at 10:52am
Print Post  
Do you call the control' methods from multiple threads?

Stoyan
  
Back to top
 
IP Logged
 
ampersand
Junior Member
**
Offline



Posts: 55
Joined: Sep 21st, 2006
Re: OverflowException
Reply #2 - Oct 27th, 2006 at 11:00am
Print Post  
No, I am using the standard code for Windows Forms Applications

Code
Select All
using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace ChartTest
{

static class Program

{


/// <summary>


/// The main entry point for the application.


/// </summary>


[STAThread]


static void Main()


{



Application.EnableVisualStyles();



Application.SetCompatibleTextRenderingDefault(false);



Application.Run(new chartForm());


}

}
} 



Dirk
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: OverflowException
Reply #3 - Oct 27th, 2006 at 11:22am
Print Post  
I wonder about these lines:

  at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
  at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
  at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
  at System.Threading.ThreadHelper.ThreadStart()

Does that problem happen only when running the application from Visual Studio? It might be that VS loads the application assembly in a second thread when running in debug mode, and some multi-threading problem might happen in GDI+:

at System.Drawing.Graphics.CheckErrorStatus(Int32 status)

Stoyan
  
Back to top
 
IP Logged
 
ampersand
Junior Member
**
Offline



Posts: 55
Joined: Sep 21st, 2006
Re: OverflowException
Reply #4 - Oct 27th, 2006 at 11:37am
Print Post  
If the exception rises in designtime and right afterwards I start the exe directly from the debug folder the exception rises always.

If I don't get the exception in Visual Studio I never get it if I run the exe from outside VS.

So far I am not able to reproduce the occurence of the exception - it just happens from time to time. Or at least I don't see the systematics behind it.

Here's the exception I just received (after 15-20 times without it). It's slightly different so I post it again:

Quote:
System.OverflowException was unhandled
  Message="Overflow error."
  Source="System.Drawing"
  StackTrace:
      at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
      at System.Drawing.Graphics.FillRectangle(Brush brush, Single x, Single y, Single width, Single height)
      at System.Drawing.Graphics.FillRectangle(Brush brush, RectangleF rect)
      at MindFusion.FlowChartX.Box.Draw(Graphics g, Boolean shadow)
      at MindFusion.FlowChartX.FlowChart.x9f757d58c3f19063(Graphics x4b101060f4767186, ChartObject xa59bff7708de3a18, Boolean x79ee3f6bdf75f984)
      at MindFusion.FlowChartX.FlowChart.xd284222047afc3d7(Graphics x4b101060f4767186, RectangleF xd0772cd9ac472b96, Boolean x979174172ae18db3)
      at MindFusion.FlowChartX.FlowChart.x525e7084c19f09ac(Bitmap xcb82cf45bd90fc15, Rectangle xd1cff1e8f8666dbe, Boolean x979174172ae18db3, Boolean x650cceda2a9df79e)
      at MindFusion.FlowChartX.FlowChart.x525e7084c19f09ac(Bitmap xcb82cf45bd90fc15, Rectangle xd1cff1e8f8666dbe, Boolean x979174172ae18db3)
      at MindFusion.FlowChartX.FlowChart.OnPaint(PaintEventArgs pe)
      at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
      at System.Windows.Forms.Control.WmPaint(Message& m)
      at System.Windows.Forms.Control.WndProc(Message& m)
      at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
      at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
      at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
      at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
      at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNat
iveMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
      at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
      at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
      at System.Windows.Forms.Application.Run(Form mainForm)
      at ChartTest.Program.Main() in D:\PRG\ChartTest\ChartTest\Program.cs:line 17
      at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
      at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
      at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
      at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
      at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
      at System.Threading.ThreadHelper.ThreadStart()


Dirk
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: OverflowException
Reply #5 - Oct 27th, 2006 at 4:37pm
Print Post  
Is there a *.vshost.exe file in the bin\debug folder? Try what will happen if you delete that file after getting the exception in design time, and then run the project's exe file from the debug folder.

Stoyan
  
Back to top
 
IP Logged
 
ampersand
Junior Member
**
Offline



Posts: 55
Joined: Sep 21st, 2006
Re: OverflowException
Reply #6 - Nov 10th, 2006 at 8:01am
Print Post  
My problem seems to get worse. Right now I get the overflow error every time I click on the document to create a box.

I deleted the vshost.exe and started the exe from debug folder. I get the same exception but with some additional information (see below). Remarkable perhaps is that the flowchart document shows a big red cross when I press continue on the exception screen.

Quote:
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.OverflowException: Overflow error.
   at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
   at System.Drawing.Graphics.FillRectangle(Brush brush, Single x, Single y, Single width, Single height)
   at System.Drawing.Graphics.FillRectangle(Brush brush, RectangleF rect)
   at MindFusion.FlowChartX.Box.Draw(Graphics g, Boolean shadow)
   at MindFusion.FlowChartX.FlowChart.OnMouseMove(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseMove(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
TestApp
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///D:/PRG/LayoutControlSolution/TestApp/bin/Debug/TestApp.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e
089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll

----------------------------------------
System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/Sy
stem.Drawing.dll
----------------------------------------
System.Configuration
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50
a3a/System.Configuration.dll
----------------------------------------
System.Xml
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.42 (RTM.050727-4200)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System
.Xml.dll
----------------------------------------
LayoutControl
    Assembly Version: 1.0.2505.19445
    Win32 Version: 1.0.0.0
    CodeBase: file:///D:/PRG/LayoutControlSolution/TestApp/bin/Debug/LayoutControl.DLL
----------------------------------------
FlowChart.NET
    Assembly Version: 4.2.1.26067
    Win32 Version: 4.2.1.26067
    CodeBase: file:///D:/PRG/LayoutControlSolution/TestApp/bin/Debug/FlowChart.NET.DLL
----------------------------------------
Ruler
    Assembly Version: 4.2.1.26086
    Win32 Version: 4.2.1.26086
    CodeBase: file:///D:/PRG/LayoutControlSolution/TestApp/bin/Debug/Ruler.DLL
----------------------------------------
MEFlowChart
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///D:/PRG/LayoutControlSolution/TestApp/bin/Debug/MEFlowChart.DLL
----------------------------------------
TableSizer
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///D:/PRG/LayoutControlSolution/TestApp/bin/Debug/TableSizer.DLL
----------------------------------------
MERichTextBoxControl
    Assembly Version: 1.0.2505.18980
    Win32 Version: 1.0.0.0
    CodeBase: file:///D:/PRG/LayoutControlSolution/TestApp/bin/Debug/MERichTextBoxControl.DLL
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.



I am getting a bit desperate as I can not track down the problem.
Please tell if I should post all the sourcecode the program runs through until the exception appears.

Thanks
Dirk
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: OverflowException
Reply #7 - Nov 10th, 2006 at 8:19am
Print Post  
Hi,

Could you email me your project?

Stoyan
  
Back to top
 
IP Logged
 
ampersand
Junior Member
**
Offline



Posts: 55
Joined: Sep 21st, 2006
Re: OverflowException
Reply #8 - Nov 10th, 2006 at 8:32am
Print Post  
Email just sent out.

Dirk
  
Back to top
 
IP Logged
 
ampersand
Junior Member
**
Offline



Posts: 55
Joined: Sep 21st, 2006
Re: OverflowException
Reply #9 - Nov 10th, 2006 at 9:31am
Print Post  
I forgot to mention, how you can reproduce the error Smiley

Just click on the rectangle symbol in the toolbar, then click somewhere on the document to start drawing the rectangle.
The exception appears right after you do the click.

Dirk
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: OverflowException
Reply #10 - Nov 10th, 2006 at 9:57am
Print Post  
Ok, that happens because GridSizeX/Y are 0. Set a larger value and it should work. Set AlignToGrid = false if you don't want to use the grid. There was a check for 0 value in the old GridSize property, but it seems we forgot the check when we added the X/Y properties.

Stoyan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: OverflowException
Reply #11 - Nov 10th, 2006 at 10:00am
Print Post  
To clarify - instead of throwing a DivideByZero exception, .NET returns a NaN value when the control tries to align a point to the 0-size grid. Then we try to draw at the NaN point, and GDI throws the overflow exception  Embarrassed

Stoyan
  
Back to top
 
IP Logged
 
ampersand
Junior Member
**
Offline



Posts: 55
Joined: Sep 21st, 2006
Re: OverflowException
Reply #12 - Nov 10th, 2006 at 10:28am
Print Post  
As always your support is fantastic.

Thanks for your help.

Dirk
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint