CosmosOS / IL2CPU

IL2CPU is a compiler for .NET IL code to compile to assembly language for direct booting.
BSD 3-Clause "New" or "Revised" License
279 stars 71 forks source link

IL2CPU randomly fails at "Detecting fields for type 'IL2CPU.Debug.Symbols.LOCAL_ARGUMENT_INFO'" #204

Open GoldenretriverYT opened 1 year ago

GoldenretriverYT commented 1 year ago

After adding some code (CommandEDIT class), I started getting this error.

1>------ Erstellen gestartet: Projekt: EtorumOS, Konfiguration: Debug Any CPU ------
1>Analysetools werden übersprungen, um den Build zu beschleunigen. Sie können den Befehl „Build“ oder „Rebuild“ ausführen, um Analyzer auszuführen.
1>C:\Users\user\source\repos\EtorumOS\EtorumOS\ETOScript\Commands\CommandCD.cs(2,7,2,18): warning CS0105: Die using-Direktive für "EtorumOS.IO" ist bereits vorher in diesem Namespace aufgetreten.
1>C:\Users\user\source\repos\EtorumOS\EtorumOS\ETOScript\Commands\CommandHELP.cs(2,7,2,18): warning CS0105: Die using-Direktive für "EtorumOS.IO" ist bereits vorher in diesem Namespace aufgetreten.
1>C:\Users\user\source\repos\EtorumOS\EtorumOS\ETOScript\Commands\Command.cs(150,17,150,34): warning CS0472: Das Ergebnis des Ausdrucks ist immer "false", da ein Wert vom Typ "int" niemals NULL vom Typ "int?" ist.
1>C:\Users\user\source\repos\EtorumOS\EtorumOS\Resources\ResourceManager.cs(20,30,20,41): warning CS0649: Dem Feld "ResourceManager.ZapLightPSF" wird nie etwas zugewiesen, und es hat immer seinen Standardwert von "null".
1>C:\Users\user\source\repos\EtorumOS\EtorumOS\ETOScript\Commands\CommandEDIT.cs(15,63,15,73): warning CS0414: Dem Feld "CommandEDIT.prevScollY" wurde ein Wert zugewiesen, der aber nie verwendet wird.
1>C:\Users\user\source\repos\EtorumOS\EtorumOS\ETOScript\Commands\CommandEDIT.cs(15,46,15,57): warning CS0414: Dem Feld "CommandEDIT.prevScrollX" wurde ein Wert zugewiesen, der aber nie verwendet wird.
1>EtorumOS -> C:\Users\user\source\repos\EtorumOS\EtorumOS\bin\Debug\net6.0\EtorumOS.dll
1>Executing IL2CPU on assembly
1>Kernel Base: Cosmos.System.Kernel
1>Checking target assembly: C:\Users\user\source\repos\EtorumOS\EtorumOS\bin\Debug\net6.0\EtorumOS.dll
1>IL2CPU : warning : Loading plugs from assembly: EtorumOS.Plugs, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
1>IL2CPU : warning : Loading plugs from assembly: Cosmos.Core_Asm, Version=10.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983
1>IL2CPU : warning : Loading plugs from assembly: Cosmos.Core_Plugs, Version=10.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983
1>IL2CPU : warning : Loading plugs from assembly: Cosmos.Debug.Kernel.Plugs.Asm, Version=10.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983
1>IL2CPU : warning : Loading plugs from assembly: Cosmos.System2_Plugs, Version=10.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983
1>Detecting fields for type 'IL2CPU.Debug.Symbols.FIELD_INFO'
1>Detecting fields for type 'IL2CPU.Debug.Symbols.FIELD_MAPPING'
1>Detecting fields for type 'IL2CPU.Debug.Symbols.MethodIlOp'
1>Detecting fields for type 'IL2CPU.Debug.Symbols.Document'
1>Detecting fields for type 'IL2CPU.Debug.Symbols.AssemblyFile'
1>Detecting fields for type 'IL2CPU.Debug.Symbols.Method'
1>Detecting fields for type 'IL2CPU.Debug.Symbols.LOCAL_ARGUMENT_INFO'
1>IL2CPU : error : Exception: System.InvalidOperationException: Value must be set.
1>   at Microsoft.Data.Sqlite.SqliteParameter.Bind(sqlite3_stmt stmt)
1>   at Microsoft.Data.Sqlite.SqliteParameterCollection.Bind(sqlite3_stmt stmt)
1>   at Microsoft.Data.Sqlite.SqliteCommand.GetStatements(Stopwatch timer)+MoveNext()
1>   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
1>   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
1>   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
1>   at IL2CPU.Debug.Symbols.SqliteBulkCopy.WriteToServer(IDataReader reader) in C:\Users\user\source\repos\Cosmos\IL2CPU\source\IL2CPU.Debug.Symbols\SqliteBulkCopy.cs:line 63
1>   at IL2CPU.Debug.Symbols.DebugInfo.BulkInsert[T](String aTableName, IList`1 aList, Int32 aFlushSize, Boolean aFlush) in C:\Users\user\source\repos\Cosmos\IL2CPU\source\IL2CPU.Debug.Symbols\DebugInfo.cs:line 512
1>   at IL2CPU.Debug.Symbols.DebugInfo.WriteAllLocalsArgumentsInfos(IList`1 aInfos) in C:\Users\user\source\repos\Cosmos\IL2CPU\source\IL2CPU.Debug.Symbols\DebugInfo.cs:line 487
1>   at Cosmos.IL2CPU.AppAssembler.FinalizeDebugInfo() in C:\Users\user\source\repos\Cosmos\IL2CPU\source\Cosmos.IL2CPU\AppAssembler.cs:line 414
1>   at Cosmos.IL2CPU.CompilerEngine.Execute() in C:\Users\user\source\repos\Cosmos\IL2CPU\source\Cosmos.IL2CPU\CompilerEngine.cs:line 197
1>IL2CPU task took 00:00:23.6525567
1>Die Erstellung des Projekts "EtorumOS.csproj" ist abgeschlossen -- FEHLER.
========== Build: 0 erfolgreich, 1 Fehler, 2 aktuell, 0 übersprungen ==========
========== Erstellen wurde am 2:35 PM gestartet und dauerte 24,750 Sekunden ==========

Can be, most likely, reproduced with this repo: https://github.com/GoldenretriverYT/EtorumOS/tree/4b9d38be586a8833b6e609e2514b0e5d197d5180

GoldenretriverYT commented 1 year ago

I have taken a look at it, it apparently happens when it inserts the local arguments info for methodlabel SystemInt32SystemCollectionsGenericLargeArrayBuilder1SystemStringCopyTog__CopyToCoresLine17_0SystemStringarraySystemInt32SystemCollectionsGenericLargeArrayBuilder1compiCF838E40B78958D0E25D02A89EDB9D69

GoldenretriverYT commented 1 year ago

image It happens with this method it seems (as the previous inserts are about these arguments and the method name matches too) but it tries to insert a third argument despite there not being a third one, causing Name of the LOCAL_ARGUMENT_INFO being null - which causes the crash.

quajak commented 1 year ago

Thanks for the reproduction case