Error getting locals after exception is thrown in constructor

Hi,
With Toffeev1 set to no, after an exceptions is raised the locals window stops working.
I have a breakpoint set on the raise


and then when I step over the raise, close the exception dialog.

the locals window says error getting locals and a nullreferenceexception as the value.
SimpleXIBApp.zip (2.5 MB)
From the stack trace is sort of looks like it doesn’t like raising the exception at that point. Shouldnt the locals window be able to handle that better ?
Cheers,
John

e

It also has the same problem if I move the raise outside the constructor

    method application(application: UIApplication) didFinishLaunchingWithOptions(launchOptions: NSDictionary): Boolean;
    begin
      window := new UIWindow();
      window.rootViewController := new UINavigationController withRootViewController(new ViewController);

        // Custom initialization
      raise new ArgumentNullException;

      window.makeKeyAndVisible;
      result := true;

So Im thinking its maybe 2 issues

Cheers,
John

Can i get the full exception info? it should show in the Activity window.

This looks like its for the watch window

<- Exception in block: System.NullReferenceException: Object reference not set to an instance of an object
  at RemObjects.Elements.Debugger.Native.Utilities.DecodeULEB128 (RemObjects.Elements.Debugger.Native.DebugInfo.DWARF.MyUnmanagedMemoryAccessor source, System.Int64& pos) [0x0000e] in <6926eb10b0e54ff8a01bb800c9a40ab1>:0 
  at RemObjects.Elements.Debugger.Native.DebugInfo.DWARF.DwarfDebugInfo.Read (RemObjects.Elements.Debugger.Native.DebugInfo.DWARF.DwarfReader& reader, RemObjects.Elements.Debugger.Native.DebugInfo.DWARF.DwarfBaseItem current) [0x0000c] in <6926eb10b0e54ff8a01bb800c9a40ab1>:0 
  at RemObjects.Elements.Debugger.Native.DebugInfo.DWARF.DwarfCompileUnit.ReadChildren (RemObjects.Elements.Debugger.Native.DebugInfo.DWARF.DwarfReader& reader) [0x00030] in <6926eb10b0e54ff8a01bb800c9a40ab1>:0 
  at RemObjects.Elements.Debugger.Native.DebugInfo.DWARF.DwarfCompileUnit.ReadChildren () [0x0001f] in <6926eb10b0e54ff8a01bb800c9a40ab1>:0 
  at RemObjects.Elements.Debugger.Native.DebugInfo.DWARF.DwarfModuleSymbolInfo.LoadCUInfo () [0x0004e] in <6926eb10b0e54ff8a01bb800c9a40ab1>:0 
  at RemObjects.Elements.Debugger.Native.Formats.MergedDebugInfo.GetSymbol (System.UInt64 pos, System.Boolean load) [0x00043] in <6926eb10b0e54ff8a01bb800c9a40ab1>:0 
  at RemObjects.Elements.Debugger.Native.DebugModule.GetSymbol (System.UInt64 aAddress, System.Boolean aNotExactAddress, System.Boolean aLoad) [0x00016] in <6926eb10b0e54ff8a01bb800c9a40ab1>:0 
  at RemObjects.Elements.Debugger.Native.Remote.DebugSignalExceptionObject.get_ExceptionObject () [0x000fd] in <6926eb10b0e54ff8a01bb800c9a40ab1>:0 
  at RemObjects.Elements.Debugger.IslandDebugEngine.FillFrameData (RemObjects.Elements.Debugger.StackFrameInfo ec) [0x002ba] in <6926eb10b0e54ff8a01bb800c9a40ab1>:0 
  at RemObjects.Elements.Debugger.StackFrameInfo.get_Self () [0x00009] in <6926eb10b0e54ff8a01bb800c9a40ab1>:0 
  at (wrapper native-to-managed) RemObjects.Elements.Debugger.StackFrameInfo.get_Self(RemObjects.Elements.Debugger.StackFrameInfo,System.Exception&) at 0   CoreFoundation                      0x0000000192658418 __exceptionPreprocess + 176
1   libobjc.A.dylib                     0x00000001921a2ea8 objc_exception_throw + 60
2   Fire                                0x00000001012a3310 +[__RemObjects_Marzipan_MZObject raiseException:] + 276
3   Fire                                0x000000010125d3d0 -[__RemObjects_Fire_ManagedWrapper_StackFrameInfo Self] + 200
4   Fire                                0x000000010146107c __RemObjects_Fire_ProjectSystem_TextFile__<>c__DisplayClass55 <getLocals>b__2$0 + 368
5   Fire                                0x0000000100dab8b8 -[SBLSingleThreadedQueue processQueue:] + 564
6   Fire                                0x0000000100dab534 -[SBLSingleThreadedQueue main] + 408
7   Foundation                          0x00000001934dd470 __NSThread__start__ + 716
8   libsystem_pthread.dylib             0x00000001924fe06c _pthread_start + 148
9   libsystem_pthread.dylib             0x00000001924f8e2c thread_start + 8

Logged as bugs://E26295.

bugs://E26295 was closed as fixed.

Do I just need to download a new zip distro or would it require a new fire build ?

New Fire.

I get this now

<- Exception in block: System.InvalidCastException: Specified cast is not valid.
  at System.Convert.ToUInt64 (System.Object value) [0x00003] in <408d8cf79964489191642ba1cdb888db>:0 
  at RemObjects.Elements.Debugger.Native.DebugInfo.DWARF.DwarfValue.GetCocoaClassInfo () [0x000b9] in <0d06629752284f6bb9aec956f2b3047d>:0 
  at RemObjects.Elements.Debugger.IslandDebugEngine.FindObjcType (System.String aName, RemObjects.Elements.Debugger.Native.IDebugValue aValue) [0x00008] in <0d06629752284f6bb9aec956f2b3047d>:0 
  at RemObjects.Elements.Debugger.IslandValue.GetMembers (RemObjects.Elements.Debugger.Evaluator aVal) [0x010a7] in <0d06629752284f6bb9aec956f2b3047d>:0 
  at (wrapper native-to-managed) RemObjects.Elements.Debugger.EvaluatorValue.GetMembers(RemObjects.Elements.Debugger.EvaluatorValue,RemObjects.Elements.Debugger.Evaluator,System.Exception&) at 0   CoreFoundation                      0x0000000196774418 __exceptionPreprocess + 176
1   libobjc.A.dylib                     0x00000001962beea8 objc_exception_throw + 60
2   Fire                                0x0000000105427578 +[__RemObjects_Marzipan_MZObject raiseException:] + 276
3   Fire                                0x00000001053deae8 -[__RemObjects_Fire_ManagedWrapper_EvaluatorValue GetMembers:] + 240
4   Fire                                0x00000001054581c0 __RemObjects_Fire_ProjectSystem_DebugEvaluation__<>c__DisplayClass1 <fillChildrenWithCallback>b__0$0 + 184
5   Fire                                0x0000000104f2fb20 -[SBLSingleThreadedQueue processQueue:] + 564
6   Fire                                0x0000000104f2f79c -[SBLSingleThreadedQueue main] + 408
7   Foundation                          0x00000001975f9470 __NSThread__start__ + 716
8   libsystem_pthread.dylib             0x000000019661a06c _pthread_start + 148
9   libsystem_pthread.dylib             0x0000000196614e2c thread_start + 8

The locals window looks ok

Would this be an unrelated issue? what are the steps to reproduce?

sorry I think this is my mistake because I cant reproduce the InvalidCastException.

If I run the sample I attached in the first post. I get the original error. The locals window is now fixed but should it be showing me an AgumentNullException or a NullReferenceException ?

From the callstack it looks like the ArgumentException ctor raises an NRE… I’ll check the code. Is this Island or Toffee?

Reproduced. curiously for Island, but not ToffeeV1, even tough this toffee code looks fishy, with the result :=

    constructor(aMessage: String);
    begin
      {$IF TOFFEE}
      result := inherited constructor withName('Exception') reason(aMessage) userInfo(nil);
      {$ELSE}
      inherited constructor(aMessage);
      {$ENDIF}
    end;

Fixed, i think (blind/untested). TOFFEE of course builds for ToffeeV2, but it seems “result :=” is fine in Toffee (though wrong) but not in Island. The NRE happened in Toffeev2 only.

I’ll log to see of the compiler should fail on result := in the ctor.

Logged as bugs://E26306.

I guess I need to build from source to try this ?

Yes, or get next build

I tested with today build, it didnt seem to make a difference. Did you manage to fix the community license for rtl2 ? I wanted to debug against that on my local

You mean the NRE inside ArgumentNullException? Strange. FWIW, the change was merged, but ofc it could be that the issue was something else; I didn’t get a chance to retest yet, myself.

Not yet, will check now

I have no idea what the code is doing :slight_smile:

Im just running the sample attached to the first post. It gets into ExternalCalls.RaiseException in PosixHelpers in Island code.