Jump to content
PeterPanettone

Delphi 12: Invalid class typecast

Recommended Posts

image.thumb.png.8681d2753844c8c5ccab5afcf8258fa4.png

 

This error occurs in Delphi 12 with MMX 15_1_8_2580 each time when trying to SAVE in the IDE. (The error does not happen when MMX is not loaded). The error occurs only in a specific project.

This makes it impossible to use MMX in that specific project. This project is quite large. How can I find out what causes this error?

 

This is the text from the Error dialog:

 

[593EE537]{mmx_bds23.dll} CustomPascalExplorers.TCustomPascalModuleExplorer.ReadToken (Line 1584, "CustomPascalExplorers.pas" + 114) + $11
[633EA4CE]{rtl290.bpl  } System.ErrorAt (Line 5907, "System.pas" + 3) + $4
[633F03B3]{rtl290.bpl  } System.@AsClass (Line 18904, "System.pas" + 3) + $5
[593EE537]{mmx_bds23.dll} CustomPascalExplorers.TCustomPascalModuleExplorer.ReadToken (Line 1584, "CustomPascalExplorers.pas" + 114) + $11
[593F0575]{mmx_bds23.dll} DelphiExplorers.TDelphiModuleExplorer.InternalRefresh (Line 409, "DelphiExplorers.pas" + 12) + $3
[593EBD6B]{mmx_bds23.dll} CustomPascalExplorers.TCustomPascalModuleExplorer.DoRefresh (Line 548, "CustomPascalExplorers.pas" + 63) + $8
[593DCB91]{mmx_bds23.dll} ModuleExplorers.TModuleExplorer.DoRefresh (Line 406, "ModuleExplorers.pas" + 4) + $9
[593DCE4A]{mmx_bds23.dll} ModuleExplorers.TModuleExplorer.Refresh (Line 548, "ModuleExplorers.pas" + 0) + $2
[593F7DF8]{mmx_bds23.dll} ModCache.TModuleCache.ImmediateRefresh (Line 1187, "ModCache.PAS" + 5) + $17
[593F66E4]{mmx_bds23.dll} ModCache.TModuleInfo.ForceSynchronization (Line 439, "ModCache.PAS" + 6) + $7
[594C1CC5]{mmx_bds23.dll} MMXModLinks.TMMXModuleLink.ForceSynchronization (Line 270, "MMXModLinks.pas" + 1) + $9
[595714A6]{mmx_bds23.dll} DelphiTopModTrackers.TDelphiTopModuleTracker.IDEModuleSaved (Line 112, "DelphiTopModTrackers.pas" + 😎 + $5
[594ED04F]{mmx_bds23.dll} OTANotifiers.TOTANotifications.ModuleSaved (Line 677, "OTANotifiers.PAS" + 6) + $6
[594EC14F]{mmx_bds23.dll} OTANotifiers.TOTANotifier.AfterSave (Line 230, "OTANotifiers.PAS" + 2) + $E
[62BA5F98]{coreide290.bpl} DocModul.TCodeIDocModule.NotifyAfterSaveEvent (Line 2471, "DocModul.pas" + 4) + $5
[649B02AC]{designide290.bpl} ToolUtils.ForEach (Line 116, "ToolUtils.pas" + 9) + $F
[62BA600E]{coreide290.bpl} DocModul.TCodeIDocModule.NotifyAfterSave (Line 2478, "DocModul.pas" + 1) + $B
[62BA3E1B]{coreide290.bpl} DocModul.TDocModule.TheMalteseFalcon (Line 1522, "DocModul.pas" + 66) + $9
[634A79AD]{rtl290.bpl  } System.Rtti.RawInvoke (Line 8622, "System.Rtti.pas" + 46) + $0
[634A7D90]{rtl290.bpl  } System.Rtti.Invoke (Line 8867, "System.Rtti.pas" + 84) + $6
[633FA023]{rtl290.bpl  } System.TInterfacedObject.QueryInterface (Line 40187, "System.pas" + 1) + $8
[63437E3F]{rtl290.bpl  } System.SysUtils.Supports (Line 28493, "System.SysUtils.pas" + 1) + $D
[633F8B6C]{rtl290.bpl  } System.@IntfClear (Line 39066, "System.pas" + 10) + $0
[62BCE14F]{coreide290.bpl} CodeMgr.EventInfoToTypeData (Line 1895, "CodeMgr.pas" + 35) + $20
[5B4DB9D5]{boreditu.dll} EK_FLBUF.OBJ.@C7_0 + $495
[634BA8F5]{rtl290.bpl  } System.Rtti.{System.Generics.Collections}TObjectDictionary<System.Pointer,System.Rtti.TRttiObject>.ValueNotify (Line 8698, "System.Generics.Collections.pas" + 1) + $7
[633F0779]{rtl290.bpl  } System.@AfterConstruction (Line 19703, "System.pas" + 2) + $5
[633F4A5C]{rtl290.bpl  } System.@FinalizeRecord (Line 33248, "System.pas" + 81) + $2
[633F0A28]{rtl290.bpl  } System.TMonitor.Destroy (Line 19930, "System.pas" + 0) + $0
[633F015D]{rtl290.bpl  } System.TObject.CleanupInstance (Line 18632, "System.pas" + 23) + $0
[633EA294]{rtl290.bpl  } System.@FreeMem (Line 5008, "System.pas" + 20) + $0
[633EFF8C]{rtl290.bpl  } System.TObject.FreeInstance (Line 18333, "System.pas" + 2) + $2
[633F0756]{rtl290.bpl  } System.@ClassDestroy (Line 19697, "System.pas" + 0) + $2
[633F0075]{rtl290.bpl  } System.TObject.Destroy (Line 18388, "System.pas" + 1) + $4
[633F0779]{rtl290.bpl  } System.@AfterConstruction (Line 19703, "System.pas" + 2) + $5
[6347A4B7]{rtl290.bpl  } System.SyncObjs.TCriticalSection.Release (Line 1140, "System.SyncObjs.pas" + 1) + $A
[6347A4E2]{rtl290.bpl  } System.SyncObjs.TCriticalSection.Leave (Line 1155, "System.SyncObjs.pas" + 0) + $2
[6349BCFD]{rtl290.bpl  } System.Rtti.TRttiPackage.ReadObject (Line 5741, "System.Rtti.pas" + 14) + $6
[633F1800]{rtl290.bpl  } System.@TryFinallyExit (Line 23776, "System.pas" + 😎 + $0
[633EA278]{rtl290.bpl  } System.@GetMem (Line 4960, "System.pas" + 20) + $0
[633F227E]{rtl290.bpl  } System.@NewUnicodeString (Line 26024, "System.pas" + 10) + $0
[633F390F]{rtl290.bpl  } System.@UStrSetLength (Line 31341, "System.pas" + 74) + $0
[633EFD1E]{rtl290.bpl  } System.UTF8IdentToString (Line 18053, "System.pas" + 2) + $4
[633F0779]{rtl290.bpl  } System.@AfterConstruction (Line 19703, "System.pas" + 2) + $5
[634A8748]{rtl290.bpl  } System.Rtti.TRttiInstMethParameter.Create (Line 10249, "System.Rtti.pas" + 7) + $2F
[6347A4B7]{rtl290.bpl  } System.SyncObjs.TCriticalSection.Release (Line 1140, "System.SyncObjs.pas" + 1) + $A
[6347A4E2]{rtl290.bpl  } System.SyncObjs.TCriticalSection.Leave (Line 1155, "System.SyncObjs.pas" + 0) + $2
[6349BCFD]{rtl290.bpl  } System.Rtti.TRttiPackage.ReadObject (Line 5741, "System.Rtti.pas" + 14) + $6
[633F037A]{rtl290.bpl  } System.@IsClass (Line 18897, "System.pas" + 1) + $8
[6349D989]{rtl290.bpl  } System.Rtti.TRttiInstanceMethodEx.DispatchInvoke (Line 6622, "System.Rtti.pas" + 103) + $1A
[634A8130]{rtl290.bpl  } System.Rtti.TRttiMethod.Invoke (Line 10154, "System.Rtti.pas" + 1) + $11
[634A814A]{rtl290.bpl  } System.Rtti.TRttiMethod.Invoke (Line 10155, "System.Rtti.pas" + 2) + $17
[00F19340]{bds.exe     } SanctuaryChecker.TLicenseManager.TryAction + $11C
[633F47FB]{rtl290.bpl  } System.@InitializeArray (Line 32926, "System.pas" + 26) + $D
[62BA3A17]{coreide290.bpl} DocModul.TDocModule.Save (Line 1434, "DocModul.pas" + 7) + $34
[6299E7D1]{coreide290.bpl} SourceModule.TSourceModule.Save (Line 1021, "SourceModule.pas" + 17) + $B
[62BA8BA5]{coreide290.bpl} DocModul.SaveModifiedModules (Line 3697, "DocModul.pas" + 57) + $13
[62BA8CBA]{coreide290.bpl} DocModul.SaveModifiedModules (Line 3717, "DocModul.pas" + 77) + $4
[00EE8F19]{bds.exe     } AppMain.TAppBuilder.FileSaveAll + $5
[63513943]{rtl290.bpl  } System.Classes.TBasicAction.Execute (Line 18563, "System.Classes.pas" + 3) + $7
[621233B2]{vcl290.bpl  } Vcl.ActnList.TCustomAction.Execute (Line 284, "Vcl.ActnList.pas" + 19) + $35
[635136F5]{rtl290.bpl  } System.Classes.TBasicActionLink.Execute (Line 18458, "System.Classes.pas" + 😎 + $7
[6213F2F8]{vcl290.bpl  } Vcl.Controls.TControl.Click (Line 8034, "Vcl.Controls.pas" + 7) + $7
[621CCBA8]{vcl290.bpl  } Vcl.ComCtrls.TToolButton.Click (Line 23364, "Vcl.ComCtrls.pas" + 0) + $0
[6213F7C3]{vcl290.bpl  } Vcl.Controls.TControl.WMLButtonUp (Line 8175, "Vcl.Controls.pas" + 7) + $6
[6213EDB6]{vcl290.bpl  } Vcl.Controls.TControl.WndProc (Line 7920, "Vcl.Controls.pas" + 91) + $6
[6224BB87]{vcl290.bpl  } Vcl.Themes.TStyleManager.GetStyle (Line 5822, "Vcl.Themes.pas" + 7) + $D
[633F1800]{rtl290.bpl  } System.@TryFinallyExit (Line 23776, "System.pas" + 😎 + $0
[6224BC75]{vcl290.bpl  } Vcl.Themes.TStyleManager.GetStyle (Line 5833, "Vcl.Themes.pas" + 18) + $1E
[6214098E]{vcl290.bpl  } Vcl.Controls.TControl.GetStyleName (Line 8987, "Vcl.Controls.pas" + 5) + $7
[6342524B]{rtl290.bpl  } System.SysUtils.AnsiCompareText (Line 7359, "System.SysUtils.pas" + 2) + $2B
[633F0A28]{rtl290.bpl  } System.TMonitor.Destroy (Line 19930, "System.pas" + 0) + $0
[633F4A1B]{rtl290.bpl  } System.@FinalizeRecord (Line 33239, "System.pas" + 72) + $2
[6224BB87]{vcl290.bpl  } Vcl.Themes.TStyleManager.GetStyle (Line 5822, "Vcl.Themes.pas" + 7) + $D
[633F1800]{rtl290.bpl  } System.@TryFinallyExit (Line 23776, "System.pas" + 😎 + $0
[6213E9EC]{vcl290.bpl  } Vcl.Controls.TControl.Perform (Line 7698, "Vcl.Controls.pas" + 10) + $8
[621439C0]{vcl290.bpl  } Vcl.Controls.GetControlAtPos (Line 10844, "Vcl.Controls.pas" + 2) + $7B
[62143A92]{vcl290.bpl  } Vcl.Controls.InternalControlAtPos (Line 10868, "Vcl.Controls.pas" + 15) + $E
[6213E9EC]{vcl290.bpl  } Vcl.Controls.TControl.Perform (Line 7698, "Vcl.Controls.pas" + 10) + $8
[62143BE9]{vcl290.bpl  } Vcl.Controls.TWinControl.IsControlMouseMsg (Line 10907, "Vcl.Controls.pas" + 25) + $29
[62144240]{vcl290.bpl  } Vcl.Controls.TWinControl.WndProc (Line 11093, "Vcl.Controls.pas" + 120) + $6
[621CF099]{vcl290.bpl  } Vcl.ComCtrls.TToolBar.UpdateButtonState (Line 24710, "Vcl.ComCtrls.pas" + 11) + $27
[621CF0DA]{vcl290.bpl  } Vcl.ComCtrls.TToolBar.UpdateButtonStates (Line 24721, "Vcl.ComCtrls.pas" + 3) + $4
[621D1E52]{vcl290.bpl  } Vcl.ComCtrls.TToolBar.WndProc (Line 26364, "Vcl.ComCtrls.pas" + 100) + $6
[621438C0]{vcl290.bpl  } Vcl.Controls.TWinControl.MainWndProc (Line 10820, "Vcl.Controls.pas" + 3) + $6
[63514774]{rtl290.bpl  } System.Classes.StdWndProc (Line 19070, "System.Classes.pas" + 😎 + $0
[633F4A5C]{rtl290.bpl  } System.@FinalizeRecord (Line 33248, "System.pas" + 81) + $2
[62292EDB]{vcl290.bpl  } Vcl.Forms.TApplication.ProcessMessage (Line 13275, "Vcl.Forms.pas" + 23) + $1
[62292F1E]{vcl290.bpl  } Vcl.Forms.TApplication.HandleMessage (Line 13305, "Vcl.Forms.pas" + 1) + $4
[6229325D]{vcl290.bpl  } Vcl.Forms.TApplication.Run (Line 13444, "Vcl.Forms.pas" + 27) + $3
[00F38AD2]{bds.exe     } bds.bds + $DE
 

Edited by PeterPanettone

Share this post


Link to post
1 hour ago, PeterPanettone said:

How can I find out what causes this error?

I wish I'd know. There are other cases with a similar error, but I wasn't able to reproduce it, nor could I spot the trigger.

 

In case you can manage to create a reproducible test case I would love to use that for finding the root cause. As long as I am not able to reproduce any code change would be a blind guess.

Share this post


Link to post
54 minutes ago, Uwe Raabe said:

There are other cases with a similar error, but I wasn't able to reproduce it, nor could I spot the trigger.

My thoughts here :

1) Evidently from the stack, the exception raised by using the "as" operator.

2) This could be captured or even prevented but in all cases it can be logged and reported in better detailed report (or error message) than leaving it to the IDE to handle the exception.

  • Like 1

Share this post


Link to post
2 hours ago, Uwe Raabe said:

I wish I'd know. There are other cases with a similar error, but I wasn't able to reproduce it, nor could I spot the trigger.

As @Kas Ob. said:

Quote

This could be captured or even prevented but in all cases it can be logged and reported in better detailed report (or error message) than leaving it to the IDE to handle the exception.

Please make an MMX version that includes such a detailed error report that references the line that caused the error.

Share this post


Link to post
21 minutes ago, PeterPanettone said:

Please make an MMX version that includes such a detailed error report that references the line that caused the error.

The line number is there, in the stack call.

What needed is try.except to minimize the overhead in such places where errors/exceptions reported, while in the according exception handler a small RTTI piece of code to extract and report the offending class, the one that most likely shouldn't be there or simply lost one Interface from its definition because it is so rare to that had being missing such declaration, getting its type info should be trivial, (i think) 

  • Like 1

Share this post


Link to post

I have uploaded a new beta version that allows to do some logging: MMX Beta Setup

 

There is a new entry in MMX properties MMX Debugging:

image.thumb.png.426c229d96af6ba6da3c0a3f1fc9f6c1.png

 

Enable log to file, close IDE, install CodeSite Tools and restart IDE. Then try the same as before to trigger the exception and look in the given folder for the log file.

  • Like 1

Share this post


Link to post
3 hours ago, Uwe Raabe said:

I have uploaded a new beta version that allows to do some logging: MMX Beta Setup

Thanks, Uwe. I've installed it.

When trying to save the main unit in my Delphi 12 project, I now get this error message:

 

image.thumb.png.cbe6d170024581851916c1e55fe031b7.png 

 

(There is no error when saving any other unit in my project).

 

This is the text of the error dialog:

 

[5786061C]{mmx_bds23.dll} CustomPascalExplorers.TCustomPascalModuleExplorer.ReadToken (Line 1571, "CustomPascalExplorers.pas" + 99) + $42
[577ED8A1]{mmx_bds23.dll} Tokenizers.TMMBaseTokenizer.ReadToken (Line 624, "Tokenizers.pas" + 27) + $15
[649C218D]{rtl290.bpl  } System.@Assert (Line 25711, "System.pas" + 2) + $D
[5786061C]{mmx_bds23.dll} CustomPascalExplorers.TCustomPascalModuleExplorer.ReadToken (Line 1571, "CustomPascalExplorers.pas" + 99) + $42
[5784CE05]{mmx_bds23.dll} MMX.ReservedWords.IsReservedWord$qqrx20System.UnicodeStringr31Mmx.Reservedwords.TReservedWord (Line 76, "MMX.ReservedWords.pas" + 2) + $10
[5784CE2E]{mmx_bds23.dll} MMX.ReservedWords.IsMainResWord$qqrx20System.UnicodeStringr31Mmx.Reservedwords.TReservedWord (Line 82, "MMX.ReservedWords.pas" + 1) + $6
[57861943]{mmx_bds23.dll} CustomPascalExplorers.TCustomPascalModuleExplorer.SkipAsmBlock (Line 1893, "CustomPascalExplorers.pas" + 6) + $3
[57863D2F]{mmx_bds23.dll} DelphiExplorers.TDelphiModuleExplorer.InternalRefresh (Line 427, "DelphiExplorers.pas" + 30) + $3
[5785CAA1]{mmx_bds23.dll} CustomPascalExplorers.TCustomPascalModuleExplorer.DoRefresh (Line 550, "CustomPascalExplorers.pas" + 63) + $8
[5784A207]{mmx_bds23.dll} ModuleExplorers.TModuleExplorer.DoRefresh (Line 406, "ModuleExplorers.pas" + 4) + $B
[5784A610]{mmx_bds23.dll} ModuleExplorers.TModuleExplorer.Refresh (Line 548, "ModuleExplorers.pas" + 1) + $8
[5786DFAE]{mmx_bds23.dll} ModCache.TModuleCache.ImmediateRefresh (Line 1189, "ModCache.PAS" + 5) + $18
[5786BDD7]{mmx_bds23.dll} ModCache.TModuleInfo.ForceSynchronization (Line 441, "ModCache.PAS" + 6) + $8
[57960F58]{mmx_bds23.dll} MMXModLinks.TMMXModuleLink.ForceSynchronization (Line 270, "MMXModLinks.pas" + 1) + $F
[57A3C6CC]{mmx_bds23.dll} DelphiTopModTrackers.TDelphiTopModuleTracker.IDEModuleSaved (Line 112, "DelphiTopModTrackers.pas" + 😎 + $8
[57998D67]{mmx_bds23.dll} OTANotifiers.TOTANotifications.ModuleSaved (Line 677, "OTANotifiers.PAS" + 6) + $9
[57996930]{mmx_bds23.dll} OTANotifiers.TOTANotifier.AfterSave (Line 230, "OTANotifiers.PAS" + 2) + $13
[62DB5F98]{coreide290.bpl} DocModul.TCodeIDocModule.NotifyAfterSaveEvent (Line 2471, "DocModul.pas" + 4) + $5
[63F802AC]{designide290.bpl} ToolUtils.ForEach (Line 116, "ToolUtils.pas" + 9) + $F
[62DB600E]{coreide290.bpl} DocModul.TCodeIDocModule.NotifyAfterSave (Line 2478, "DocModul.pas" + 1) + $B
[62DB3E1B]{coreide290.bpl} DocModul.TDocModule.TheMalteseFalcon (Line 1522, "DocModul.pas" + 66) + $9
[64A779AD]{rtl290.bpl  } System.Rtti.RawInvoke (Line 8622, "System.Rtti.pas" + 46) + $0
[64A77D90]{rtl290.bpl  } System.Rtti.Invoke (Line 8867, "System.Rtti.pas" + 84) + $6
[649CA023]{rtl290.bpl  } System.TInterfacedObject.QueryInterface (Line 40187, "System.pas" + 1) + $8
[64A07E3F]{rtl290.bpl  } System.SysUtils.Supports (Line 28493, "System.SysUtils.pas" + 1) + $D
[649C8B6C]{rtl290.bpl  } System.@IntfClear (Line 39066, "System.pas" + 10) + $0
[62DDE14F]{coreide290.bpl} CodeMgr.EventInfoToTypeData (Line 1895, "CodeMgr.pas" + 35) + $20
[5BB67DC5]{boreditu.dll} EK_ENTRY.OBJ.EK_GET_LINE_CONTENTS + $501
[64B90D44]{rtl290.bpl  } System.RegularExpressionsAPI.pcre_exec (Line 6661, "C:\Projects\Yukon\tp\runtime\rtl\common\regex\pcre\source\pcre_exec.c" + 309) + $7
[64A6D989]{rtl290.bpl  } System.Rtti.TRttiInstanceMethodEx.DispatchInvoke (Line 6622, "System.Rtti.pas" + 103) + $1A
[64A78130]{rtl290.bpl  } System.Rtti.TRttiMethod.Invoke (Line 10154, "System.Rtti.pas" + 1) + $11
[64A7814A]{rtl290.bpl  } System.Rtti.TRttiMethod.Invoke (Line 10155, "System.Rtti.pas" + 2) + $17
[005A9340]{bds.exe     } SanctuaryChecker.TLicenseManager.TryAction + $11C
[649C47FB]{rtl290.bpl  } System.@InitializeArray (Line 32926, "System.pas" + 26) + $D
[62DB3A17]{coreide290.bpl} DocModul.TDocModule.Save (Line 1434, "DocModul.pas" + 7) + $34
[62BAE7D1]{coreide290.bpl} SourceModule.TSourceModule.Save (Line 1021, "SourceModule.pas" + 17) + $B
[62C77130]{coreide290.bpl} EdScript.TIDEEditorServices.WindowCommand (Line 3778, "EdScript.pas" + 12) + $20
[62D16332]{coreide290.bpl} EditorControl.TEditEventHandler.EditSaveFile (Line 9500, "EditorControl.pas" + 2) + $10
[62D11FA9]{coreide290.bpl} EditorControl.TCustomEditControl.SaveFile (Line 7405, "EditorControl.pas" + 1) + $14
[62D04E53]{coreide290.bpl} EditorControl.TCustomEditControl.CMControlCommand (Line 2211, "EditorControl.pas" + 15) + $2
[62D15CC6]{coreide290.bpl} EditorControl.TEditControl.CMControlCommand (Line 9301, "EditorControl.pas" + 14) + $0
[6454EDB6]{vcl290.bpl  } Vcl.Controls.TControl.WndProc (Line 7920, "Vcl.Controls.pas" + 91) + $6
[649C0A28]{rtl290.bpl  } System.TMonitor.Destroy (Line 19930, "System.pas" + 0) + $0
[649C4A1B]{rtl290.bpl  } System.@FinalizeRecord (Line 33239, "System.pas" + 72) + $2
[6465BB87]{vcl290.bpl  } Vcl.Themes.TStyleManager.GetStyle (Line 5822, "Vcl.Themes.pas" + 7) + $D
[649C1800]{rtl290.bpl  } System.@TryFinallyExit (Line 23776, "System.pas" + 😎 + $0
[6465BC75]{vcl290.bpl  } Vcl.Themes.TStyleManager.GetStyle (Line 5833, "Vcl.Themes.pas" + 18) + $1E
[6455098E]{vcl290.bpl  } Vcl.Controls.TControl.GetStyleName (Line 8987, "Vcl.Controls.pas" + 5) + $7
[649C056B]{rtl290.bpl  } System.TObject.Dispatch (Line 19247, "System.pas" + 11) + $0
[6465FBC5]{vcl290.bpl  } Vcl.Themes.TStyleHook.WndProc (Line 7733, "Vcl.Themes.pas" + 38) + $6
[6465FDA6]{vcl290.bpl  } Vcl.Themes.TMouseTrackControlStyleHook.WndProc (Line 7832, "Vcl.Themes.pas" + 1) + $4
[646A9124]{vcl290.bpl  } Vcl.Forms.TScrollingStyleHook.WndProc (Line 16707, "Vcl.Forms.pas" + 0) + $0
[61F8189C]{themeloader290.bpl} IDETheme.IDEStyleHooks.TEditControlIDEStyleHook.WndProc (Line 542, "IDETheme.IDEStyleHooks.pas" + 0) + $0
[6465F3EA]{vcl290.bpl  } Vcl.Themes.TStyleHook.HandleMessage (Line 7438, "Vcl.Themes.pas" + 20) + $6
[64788C80]{vcl290.bpl  } Vcl.Styles.TStyleEngine.HandleMessage (Line 3616, "Vcl.Styles.pas" + 20) + $8
[649C2729]{rtl290.bpl  } System.@UStrAsg (Line 26952, "System.pas" + 18) + $0
[6465BDA8]{vcl290.bpl  } Vcl.Themes.TStyleManager.HandleMessage (Line 5891, "Vcl.Themes.pas" + 11) + $11
[6455234F]{vcl290.bpl  } Vcl.Controls.TWinControl.DoHandleStyleMessage (Line 9953, "Vcl.Controls.pas" + 0) + $F
[645543FB]{vcl290.bpl  } Vcl.Controls.TWinControl.WndProc (Line 11151, "Vcl.Controls.pas" + 178) + $6
[2F11ABDD]{cxLibraryRS29.bpl} Dxhooks. + $0
[645538C0]{vcl290.bpl  } Vcl.Controls.TWinControl.MainWndProc (Line 10820, "Vcl.Controls.pas" + 3) + $6
[64AE4774]{rtl290.bpl  } System.Classes.StdWndProc (Line 19070, "System.Classes.pas" + 😎 + $0
[62D1F002]{coreide290.bpl} VClient.SendWindowMsg (Line 3189, "VClient.pas" + 2) + $10
[62D1D940]{coreide290.bpl} VClient.SendWindowMsgProc (Line 2041, "VClient.pas" + 1) + $D
[629D98A6]{coreide290.bpl} IDEKbd.@interpret_bmi_macro$qqrp5BMI_tpcp11CmdMapTableppc (Line 39, "bmi.cpp" + 14) + $5
[629D84A2]{coreide290.bpl} IDEKbd... (Line 599, "IDEKbd.pas" + 0) + $16E
[62D1BB58]{coreide290.bpl} VClient.CmdStringProc (Line 616, "VClient.pas" + 5) + $17
[629DA003]{coreide290.bpl} IDEKbd.@LookUpKey$qqrp11KeyMapTableul (Line 101, "keymap.cpp" + 6) + $4
[62D28A94]{coreide290.bpl} KbClient.TIDEKBDFrameAPI.MapAndEvalInternal (Line 842, "KbClient.pas" + 10) + $11
[62D2850D]{coreide290.bpl} KbClient.HandleKey (Line 572, "KbClient.pas" + 6) + $12
[62D28A1A]{coreide290.bpl} KbClient.TIDEKBDFrameAPI.ProcessKeyStroke (Line 820, "KbClient.pas" + 238) + $1
[62D295C8]{coreide290.bpl} KbClient.TIDEKBDChildAPI.ProcessKeyStroke (Line 1368, "KbClient.pas" + 14) + $16
[62D1466B]{coreide290.bpl} EditorControl.TCustomEditControl.DoKeyDown (Line 8774, "EditorControl.pas" + 33) + $18
[62D05282]{coreide290.bpl} EditorControl.TCustomEditControl.CNKeyDown (Line 2310, "EditorControl.pas" + 17) + $4
[6454EDB6]{vcl290.bpl  } Vcl.Controls.TControl.WndProc (Line 7920, "Vcl.Controls.pas" + 91) + $6
[649C0A28]{rtl290.bpl  } System.TMonitor.Destroy (Line 19930, "System.pas" + 0) + $0
[649C4A1B]{rtl290.bpl  } System.@FinalizeRecord (Line 33239, "System.pas" + 72) + $2
[6465BB87]{vcl290.bpl  } Vcl.Themes.TStyleManager.GetStyle (Line 5822, "Vcl.Themes.pas" + 7) + $D
[649C1800]{rtl290.bpl  } System.@TryFinallyExit (Line 23776, "System.pas" + 😎 + $0
[6465BC75]{vcl290.bpl  } Vcl.Themes.TStyleManager.GetStyle (Line 5833, "Vcl.Themes.pas" + 18) + $1E
[6455098E]{vcl290.bpl  } Vcl.Controls.TControl.GetStyleName (Line 8987, "Vcl.Controls.pas" + 5) + $7
[649C056B]{rtl290.bpl  } System.TObject.Dispatch (Line 19247, "System.pas" + 11) + $0
[6465FBC5]{vcl290.bpl  } Vcl.Themes.TStyleHook.WndProc (Line 7733, "Vcl.Themes.pas" + 38) + $6
[6465FDA6]{vcl290.bpl  } Vcl.Themes.TMouseTrackControlStyleHook.WndProc (Line 7832, "Vcl.Themes.pas" + 1) + $4
[646A9124]{vcl290.bpl  } Vcl.Forms.TScrollingStyleHook.WndProc (Line 16707, "Vcl.Forms.pas" + 0) + $0
[61F8189C]{themeloader290.bpl} IDETheme.IDEStyleHooks.TEditControlIDEStyleHook.WndProc (Line 542, "IDETheme.IDEStyleHooks.pas" + 0) + $0
[6465F3EA]{vcl290.bpl  } Vcl.Themes.TStyleHook.HandleMessage (Line 7438, "Vcl.Themes.pas" + 20) + $6
[64788C80]{vcl290.bpl  } Vcl.Styles.TStyleEngine.HandleMessage (Line 3616, "Vcl.Styles.pas" + 20) + $8
[649C2729]{rtl290.bpl  } System.@UStrAsg (Line 26952, "System.pas" + 18) + $0
[6465BDA8]{vcl290.bpl  } Vcl.Themes.TStyleManager.HandleMessage (Line 5891, "Vcl.Themes.pas" + 11) + $11
[6455234F]{vcl290.bpl  } Vcl.Controls.TWinControl.DoHandleStyleMessage (Line 9953, "Vcl.Controls.pas" + 0) + $F
[645543FB]{vcl290.bpl  } Vcl.Controls.TWinControl.WndProc (Line 11151, "Vcl.Controls.pas" + 178) + $6
[2F11ABDD]{cxLibraryRS29.bpl} Dxhooks. + $0
[645538C0]{vcl290.bpl  } Vcl.Controls.TWinControl.MainWndProc (Line 10820, "Vcl.Controls.pas" + 3) + $6
[64AE4774]{rtl290.bpl  } System.Classes.StdWndProc (Line 19070, "System.Classes.pas" + 😎 + $0
[646A2C10]{vcl290.bpl  } Vcl.Forms.TApplication.IsKeyMsg (Line 13183, "Vcl.Forms.pas" + 25) + $12
[646A2CAA]{vcl290.bpl  } Vcl.Forms.TApplication.IsHintMsg (Line 13204, "Vcl.Forms.pas" + 3) + $2
[646A2EB7]{vcl290.bpl  } Vcl.Forms.TApplication.ProcessMessage (Line 13269, "Vcl.Forms.pas" + 17) + $31
[646A2F1E]{vcl290.bpl  } Vcl.Forms.TApplication.HandleMessage (Line 13305, "Vcl.Forms.pas" + 1) + $4
[646A325D]{vcl290.bpl  } Vcl.Forms.TApplication.Run (Line 13444, "Vcl.Forms.pas" + 27) + $3
[005C8AD2]{bds.exe     } bds.bds + $DE
 

I hope this will help you get to the root of the problem.

Edited by PeterPanettone

Share this post


Link to post

I somehow expected that. After catching the first error it is most likely to stumble over the next one.

 

The question is: Did it write something to the log file?

Share this post


Link to post
11 hours ago, Uwe Raabe said:

I somehow expected that. After catching the first error it is most likely to stumble over the next one.

 

The question is: Did it write something to the log file?

I activated both Debugging options:

 

image.thumb.png.4400c5f223d582945f8b274782eda998.png

 

No log file is written to the indicated folder when the error occurs.

No message was sent to my CodeSite Live Viewer.

 

However, the line shown in the error message does indicate the source of the error:

 

 Assertion fehlgeschlagen (C:\CI_AWS\Ws\15164\Source|MMXmm32\Engine|Custom PascalExplorers.pas, line 1571).

 

(English: Assertion failed)

Edited by PeterPanettone

Share this post


Link to post

The problem I have is that as long I cannot reproduce it here, I simply cannot find out the root cause. 

 

The current beta catches the error at the source position from the first call stack. The new call stack throws an error at a different position. My guess is that the error is not related to the position it is shown, but has its root somewhere before.

If the sources are the same as with the first call stack, then the error shown there should have been logged. As you have no log the relevant code either succeeded or has not been executed.

 

The code in CustomPascalExplorers shown in the call stack makes the assumption that some instance is of some type and a simple AS should work. If that is not the case then something has been going seriously wrong. I need to find out what that is and how to detect and prevent it and that requires a reproducible test case which I don't have in the moment. If something has garbled the internal data structure then just masking these exceptions will do more harm than good.

 

It would help a lot if you could provide the unit triggering that error.

Share this post


Link to post
7 minutes ago, Uwe Raabe said:

exceptions will do more harm than good

I understand. But you could implement an MMX user option, "Do not Raise at Invalid Class Typecast error," so the user can at least use MMX, which currently is not possible. I cannot use MMX in one of my main projects, which is a show-stopper.

Share this post


Link to post
32 minutes ago, Uwe Raabe said:

It would help a lot if you could provide the unit triggering that error.

The unit contains a lot of uses references to classes and units that you probably don't have access to.

Edited by PeterPanettone

Share this post


Link to post
39 minutes ago, PeterPanettone said:

The unit contains a lot of uses references to classes and units that you probably don't have access to.

That is irrelevant. The error appears when MMX parses the code - it doesn't try to compile it. As long as it is syntactically correct that will do. I just need the unit, not the project. If you can strip the unit while keeping the exception thrown that would even be better.

 

44 minutes ago, PeterPanettone said:

But you could implement an MMX user option, "Do not Raise at Invalid Class Typecast error,"

That could be a bit tedious as there are more than 600 as constructs in the code where probably the majority would have to be enclosed in try-except blocks conditionally raising an exception or not. I prefer spending my time in finding the real cause instead.

Share this post


Link to post
2 minutes ago, Uwe Raabe said:

That is irrelevant. The error appears when MMX parses the code - it doesn't try to compile it. As long as it is syntactically correct that will do. I just need the unit, not the project. If you can strip the unit while keeping the exception thrown that would even be better.

How can I securely send you the unit?

Share this post


Link to post

Make a password protected zip file and send it to uwe <at>uweraabe <dot> de. Send the password inside a personal message in this forum.

Share this post


Link to post
30 minutes ago, PeterPanettone said:

How can I securely send you the unit?

Internet ?!

 

Don't be scared - I always try to put some humor into my writing.

Share this post


Link to post
1 hour ago, Uwe Raabe said:

Send the password inside a personal message in this forum.

When trying to send you the personal message, I got the response:

 

Uwe Raabe cannot receive messages.

Share this post


Link to post
9 minutes ago, Lajos Juhász said:

I would bet on the contact information at https://www.mmx-delphi.de/ there is a link legal notice with contact details.

...which is the same as the email address Uwe posted above. But he insisted on sending the password on a separate channel.

Share this post


Link to post
32 minutes ago, PeterPanettone said:

When trying to send you the personal message, I got the response:

 

Uwe Raabe cannot receive messages.

Please try again.

Share this post


Link to post

The problem has now changed: After having uninstalled all IDE plugins except MMX, the problem seemed to have gone away. So, I added the IDE plugins one after the other and restarted the IDE each time to find out the culprit.

At the end, after having added all IDE plugins as before, the MMX error message when saving the unit is no longer displayed. However, now, when I do a Save All from the file menu, it does not work: The Save-All icon remains green.

However, this happens only when MMX is loaded AND with my specific unit "MainProgramWindowManager"!

To summarize, it is the same error as before, but without the MMX error message dialog!  I don't know why the error dialog does not appear anymore, as there are the same conditions as before.

This seems to be a typical "chaos" problem (see chaos physics), where a minimal/microscopic change in the initial conditions leads to a macroscopically different result.

Edited by PeterPanettone

Share this post


Link to post
3 hours ago, PeterPanettone said:

when I do a Save All from the file menu, it does not work: The Save-All icon remains green.

The question is: doesn't it save all files or ist it just that something stays as modified so that the Save All icon is still active?

Share this post


Link to post
3 hours ago, PeterPanettone said:

After having uninstalled all IDE plugins except MMX, the problem seemed to have gone away.

At least that most likely rules out any parsing problem. That would also match the fact that I was not able to see that problem on my system.

 

Note that the current beta catches the error from the call stack you posted first and writes some error message to CodeSite instead.

Share this post


Link to post

1. These are the SAVE and SAVE-ALL icons on the empty IDE (no project loaded yet; both icons are grey):

 

image.png.7ce5e0eada13aafa89a4fb0ed484c7fa.png

 

2. These are  the SAVE and SAVE-ALL icons after loading my project (the SAVE icon has become green, while the SAVE-ALL icon is still grey):

 

image.png.74881923db8f27984f92bd56002070a9.png 

 

3. These are the SAVE and SAVE-ALL icons after having made a change to the "MainProgramWindowManager" unit (both SAVE and SAVE-ALL icons have become green):

 

image.png.be0ecfbbef8ec051a233c5bcc74e1175.png 

 

BOTH icons remain green(!) after clicking the SAVE or the SAVE-ALL icon.

 

This faulty behavior occurs only if MMX is loaded AND with the "MainProgramWindowManager" unit! (If both conditions are NOT met, clicking the SAVE button turns the SAVE-ALL icon grey: Checked and re-checked just now).

 

This proves that MMX is causing an error on saving (with this specific unit), preventing the changed unit from being displayed as saved with the SAVE-ALL icon, while the SAVED INDICATION in the code editor has been turned green after saving:

 

image.png.76540f4459b859584924b24989b31517.png

 

4. When I try to COMPILE or BUILD this changed project, then this error dialog comes up:

 

image.thumb.png.743ae8dee488f91ed7bb2a3da2bffd58.png 

 

This points to the same error from the previous MMX error message dialog (EAssertionFailed in CustomPascalExplorer.pas), thus proving that MMX prevents the project from being compiled or built.

Edited by PeterPanettone

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×