Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When interfaces breaks, be more gentle #1341

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rappen
Copy link
Collaborator

@rappen rappen commented Jun 16, 2024

Now and then, I've seen these strange error, when a tool has interface IGitHubPlugin etc, and it breaks when trying to get the username/repository. The similar for PayPal, Help, etc.

Found when debugging:
image

Error Time: 2024-06-16 10:38:28.116
System.NullReferenceException
Object reference not set to an instance of an object.
XrmToolBox
at XrmToolBox.New.NewForm.GetGithubBaseUrl(String page)
   at XrmToolBox.New.NewForm.githubPluginMenuItem_Click(Object sender, EventArgs e)
   at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
   at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ToolStrip.WndProc(Message& m)
   at System.Windows.Forms.ToolStripDropDown.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.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr 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 XrmToolBox.Program.Main(String[] args)

This PR will make XTB to be a bit nicer, since I couldn't find a way to solve this issue.

@MscrmTools
Copy link
Owner

The issue seems more related to ActiveControl being null, isn't it?

@rappen
Copy link
Collaborator Author

rappen commented Jun 20, 2024

I have no idea how that happens, but it does, now and then... No pattern found yet.
When I have tried to reproduce it, I believe the dbMain.ActiveContent is not null, but it can't be cast as either PluginForm or IGitHubPlugin (in the example above, but similar for other interfaces too).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants