Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.

Welcome, Guest
Guest Settings

Thread: Insufficient RTTI available to support this operation - Delphi XE6 - Tether

Permlink Replies: 0
Gilbert Quinn

Posts: 1
Registered: 8/25/14
Insufficient RTTI available to support this operation - Delphi XE6 - Tether
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 26, 2017 9:07 PM
I've used Delphi's Tethering Components to implement an idea I had. All works excellent, except when you decide to build the EXE. Upon startup after a fresh build I get this error:

"Insufficient RTTI available to support this operation"

This only happens after a fresh build. If I compile the application again the problem goes away and all works fine. As soon as I build the app, and I debug the code, it gives me an error on this assignment:

TetheringAppProfile := TTetheringAppProfile.Create(nil);  
  with TetheringAppProfile do
    Manager            := TetheringManager; //This line
    Text               := 'AppTether';

To try and get a workaround for this issue I decided to move my code into a package that won't be recompiled everytime I build my EXE. The idea sounded cool, but didn't work, and this leaves me baffled. What I did was to implement the idea I found here : Advanced Dynamic Packages

It shows you how to dynamically load a package in the code with your own custom methods. I used the first example. I implemented a base package that contains all the methods I want to call. This package is included as a runtime package. Then I added another package with a form that requires the base package but distributes separately. My thought processes was that if I could get the main EXE to build and the other code stayed untouched then this problem shouldn't happen. But no, when I rebuild my main exe, for some reason on that line, I still get that error. If I rebuild the one package that is dynamically loaded in code, and rerun the main exe without doing anything further, it works. Why?

I've searched around for this error but no where do I find people having this issue through the Tethering Components in XE6.

Here is the callstack:

exception class    : EInsufficientRtti
exception message  : Insufficient RTTI available to support this operation.
main thread ($4d60):
004c17a2 +000e JAM.exe      System.Rtti                             CheckCodeAddress
004ce740 +0508 JAM.exe      System.Rtti                             TRttiInstanceMethodEx.DispatchInvoke
004d7f5c +0044 JAM.exe      System.Rtti                             TRttiMethod.Invoke
010d4701 +017d JAM.exe      IPPeerAPI                               TIPPeerFactory.CreatePeer
012258c9 +0051 JAM.exe      System.Tether.NetworkAdapter            TTetheringNetworkAdapter.Create
0122592f +0007 JAM.exe      System.Tether.NetworkAdapter            TTetheringNetworkAdapter.CreateInstance
011ffa6d +0019 JAM.exe      System.Tether.Manager                   TTetheringAdapters.GetAdapterInstance
011fb98e +004a JAM.exe      System.Tether.Manager                   TTetheringManager.AutoCreateAdapters
011fdce2 +0016 JAM.exe      System.Tether.Manager                   TTetheringManager.RegisterProfile
011ff0d7 +0023 JAM.exe      System.Tether.Manager                   TTetheringProfile.SetManager
0126f62a +004e JAM.exe      uTetherPackage                  47  +11 TTetherPackage.CreateTetherComponents
01270283 +003f JAM.exe      uTetherings                    146   +6 TTetherings.CreateTetherings
01942794 +1210 JAM.exe      uMain                         1031 +321 TfrmMain.FormCreate
00686f2d +0031 JAM.exe      Vcl.Forms                     3745   +3 TCustomForm.DoCreate
00686b31 +0011 JAM.exe      Vcl.Forms                     3628   +1 TCustomForm.AfterConstruction
00409bd9 +001d JAM.exe      System                         492   +0 @AfterConstruction
00686ae3 +019b JAM.exe      Vcl.Forms                     3618  +35 TCustomForm.Create
00691546 +0076 JAM.exe      Vcl.Forms                    10470  +13 TApplication.CreateForm
01990d87 +0307 JAM.exe      JAM                           1469 +113 initialization
76d07c02 +0022 KERNEL32.DLL                                         BaseThreadInitThunk
thread $643c:
76621129 +000 KERNELBASE.dll           WaitForMultipleObjectsEx
76ffde8d +15d user32.dll               MsgWaitForMultipleObjectsEx
76ffdbda +01a user32.dll               MsgWaitForMultipleObjects
004aaa15 +00d JAM.exe        madExcept CallThreadProcSafe
004aaa7a +032 JAM.exe        madExcept ThreadExceptFrame
76d07c02 +022 KERNEL32.DLL             BaseThreadInitThunk
<div class="jive-quote"><div class="jive-quote">created by main thread ($4d60) at:</div></div>
6d8ae04a +000 gdiplus.dll
thread $587c (TDMSThread):
76612cc1 +b1 KERNELBASE.dll                        WaitForSingleObjectEx
76612bfd +0d KERNELBASE.dll                        WaitForSingleObject
010adb07 +1b JAM.exe        uSignalFlag      54 +3 TSignalFlag.WaitForSignal
010ba90d +49 JAM.exe        uDMSWriter     1672 +7 TDMSThread.Execute
004aab2f +2b JAM.exe        madExcept              HookedTThreadExecute
0052a371 +49 JAM.exe        System.Classes         ThreadProc
0040b230 +28 JAM.exe        System          492 +0 ThreadWrapper
004aaa15 +0d JAM.exe        madExcept              CallThreadProcSafe

When I try to step into the line that gives the error it takes me to System.Generics.Collections to this method:

function TEnumerable<T>.ToArrayImpl(Count: Integer): TArray<T>;
  x: T;
  // We assume our caller has passed correct Count
  SetLength(Result, Count);
  Count := 0;
  for x in Self do
    Result[Count] := x;
Here is the stack track for that part:
:01201989 {System.Generics.Collections}TDictionary<System.string,System.Tether.Manager.TTetheringAdapterClass>.TKeyCollection.ToArray + $15
:011fdcd3 TTetheringManager.RegisterProfile + $1B
:00686b37 TCustomForm.AfterConstruction + $17
Vcl.Forms.TApplication.CreateForm(???,(no value))
:76d07c04 KERNEL32.BaseThreadInitThunk + 0x24
:776eab8f ntdll.RtlInitializeExceptionChain + 0x8f
:776eab5a ntdll.RtlInitializeExceptionChain + 0x5a

The moment I step out of the ToArrayImpl method it gives that exception...

Any idea how to fix this?

Edited by: Gilbert Quinn on Jan 26, 2017 9:28 PM
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02