Note that there are some explanatory texts on larger screens.

plurals
  1. PONullReferenceException in Forms.ToolStripMenuItemInternalLayout
    text
    copied!<p>I am receiving this weird exception through automated crash reports, and I cannot figure out what causes it:</p> <pre><code>V2009.3.0.0 - System.NullReferenceException - :System.Drawing.Rectangle get_ImageRectangle():0 Version: MaxTo2009.3.0.0 Exception: System.NullReferenceException Error message: Object reference not set to an instance of an object. Stack trace: at System.Windows.Forms.ToolStripMenuItemInternalLayout.get_ImageRectangle() at System.Windows.Forms.ToolStripMenuItem.OnPaint(PaintEventArgs e) at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met) at System.Windows.Forms.ToolStrip.OnPaint(PaintEventArgs e) at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs) at System.Windows.Forms.Control.WmPaint(Message&amp; m) at System.Windows.Forms.Control.WndProc(Message&amp; m) at System.Windows.Forms.ScrollableControl.WndProc(Message&amp; m) at System.Windows.Forms.ToolStrip.WndProc(Message&amp; m) at System.Windows.Forms.ToolStripDropDown.WndProc(Message&amp; m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&amp; m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&amp; m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) </code></pre> <p>This seems to happen to a lot of people, but I cannot reproduce it. <a href="http://social.msdn.microsoft.com/Forums/de-DE/vcsharpexpresseditionde/thread/9b50cd49-4c86-43ee-82f8-d5c9e0df5108/" rel="nofollow noreferrer">The clues I found on Google</a> (basically just one post, which is in German, and I don't understand much of that) tells me this is related to the checked state of menu items. Since I haven't seen this error in earlier versions, and I've only changed one menu item in this version, this is likely to be the culprit:</p> <pre><code>private void toolStripMenuItemPassiveMode_CheckedChanged(object sender, EventArgs e) { // Calls into an unmanaged DLL and uses PostMessage SetPassiveMode(toolStripMenuItemPassiveMode.Checked); String title; String text; if (toolStripMenuItemPassiveMode.Checked &amp;&amp; !Settings.PassiveMode) { title = "Temporarily passive"; text = "You have temporarily put MaxTo into passive mode. MaxTo will only intercept maximizations while you are holding the modifier key.\n\nIf you want passive mode to be the default, you have to set it in the options."; notifyIcon.ShowBalloonTip(10000, title, text, ToolTipIcon.Info); } else if (!toolStripMenuItemPassiveMode.Checked &amp;&amp; Settings.PassiveMode) { title = "Temporarily active"; text = "You have temporarily put MaxTo into active mode. MaxTo will now intercept all window maximizations.\n\nIf you want active mode to be the default, you have to set it in the options."; notifyIcon.ShowBalloonTip(10000, title, text, ToolTipIcon.Info); } } </code></pre> <p>The menu item's Checked property is modified at two places throughout the code, yet nothing suspicious about them, as far as I can tell.</p> <p>From .designer.cs:</p> <pre><code>this.toolStripMenuItemPassiveMode.CheckOnClick = true; this.toolStripMenuItemPassiveMode.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; this.toolStripMenuItemPassiveMode.Name = "toolStripMenuItemPassiveMode"; this.toolStripMenuItemPassiveMode.Size = new System.Drawing.Size(172, 28); this.toolStripMenuItemPassiveMode.Text = "&amp;Passive mode"; this.toolStripMenuItemPassiveMode.CheckedChanged += new System.EventHandler(this.toolStripMenuItemPassiveMode_CheckedChanged); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload