I have some code in a MenuItem.Enable event, a customer recently reported that it raised a RuntimeException error (as reported by my OopsMsg method).
Without watching it execute, I can’t tell exactly what the problem is, but the code hasn’t been touched in years and is really trivial. Does anyone have thoughts on what might be causing the exception?
Here is the code (Me is the FontMenuItem that this code is part of):
// MyWnd is a window property of the MenuItemClass
// MyWnd.LayHere is a property of the MyWnd class
// MyWnd.LayoutPJO is a property of the MyWnd class
If MyWnd=Nil Then Return
if MyWnd.WorkMode<>kLayingOut Then Return
if MyWnd.LayHere=Nil Then Return
if MyWnd.LayoutPJO=Nil then Return
If Me.Tag<>Nil and Me.Tag="FontPrefs" Then
Me.Enabled=True
Return
End If
Return
Exception Err as RuntimeException
If Err IsA EndException Or Err IsA ThreadEndException Then
Raise err //Re-raise the exception
End If
OopsMsg CurrentMethodName, Err, Erln
Return
I’ll give introspection a try, this is the first time this bug has surfaced, whatever is is. Hopefully next time will be easier to puzzle out - or even better, never happen again… Thanks!
Actually, I’d forgotten that My OopsMsg method does that:
ErrorTypeStr=Introspection.GetType(ErrE).FullName
ErrMsgStr = ErrorTypeStr+" error in "+MethodStr
in this case it returns just: “RuntimeException error in FontMenuItem.EnableMenu”, plus the release version of the app.
However, without line numbers I can’t see which of those 9 lines of code was the culprit - or if it was something outside of my code. There are pictures attached to that menu, perhaps there was something wrong with them (they’re generated on the fly as font samples).