From 387990c82c57bc8ca2121685b3d2a2df79f3f170 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Petryka?= <35800402+MichalPetryka@users.noreply.github.com> Date: Sat, 11 Apr 2026 15:56:36 +0200 Subject: [PATCH 1/2] Improve debugger message for scanner failures Makes the assert use the full message used by the exception. --- .../tools/aot/ILCompiler.Compiler/Compiler/ILScanner.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ILScanner.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ILScanner.cs index 3c2c08c0005c33..c5b6d98da5b9a8 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ILScanner.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ILScanner.cs @@ -433,8 +433,9 @@ private PrecomputedDictionaryLayoutNode GetPrecomputedLayout(TypeSystemEntity me // On the path, you'll find a node that exists in both graphs, but it's predecessor // only exists in the compiler's graph. That's the place to focus the investigation on. // Use the ILCompiler-DependencyGraph-Viewer tool to investigate. - Debug.Assert(false); - throw new ScannerFailedException($"Dictionary layout of '{methodOrType}' was not computed by the IL scanner."); + string message = $"Dictionary layout of '{methodOrType}' was not computed by the IL scanner."; + Debug.Fail(message); + throw new ScannerFailedException(message); } return new PrecomputedDictionaryLayoutNode(methodOrType, layout.Slots, layout.DiscardedSlots); } From 775f08d8a954d623f477c9cca2866e9947f427e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Petryka?= <35800402+MichalPetryka@users.noreply.github.com> Date: Sat, 18 Apr 2026 01:31:09 +0200 Subject: [PATCH 2/2] Remove Debug.Assert and Debug.Fail statements --- .../tools/aot/ILCompiler.Compiler/Compiler/ILScanner.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ILScanner.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ILScanner.cs index c5b6d98da5b9a8..663125672b1af8 100644 --- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ILScanner.cs +++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ILScanner.cs @@ -331,7 +331,6 @@ internal override VTableSliceNode GetSlice(TypeDesc type) // On the path, you'll find a node that exists in both graphs, but it's predecessor // only exists in the compiler's graph. That's the place to focus the investigation on. // Use the ILCompiler-DependencyGraph-Viewer tool to investigate. - Debug.Assert(false); string typeName = ExceptionTypeNameFormatter.Instance.FormatName(type); throw new ScannerFailedException($"VTable of type '{typeName}' not computed by the IL scanner."); } @@ -433,9 +432,7 @@ private PrecomputedDictionaryLayoutNode GetPrecomputedLayout(TypeSystemEntity me // On the path, you'll find a node that exists in both graphs, but it's predecessor // only exists in the compiler's graph. That's the place to focus the investigation on. // Use the ILCompiler-DependencyGraph-Viewer tool to investigate. - string message = $"Dictionary layout of '{methodOrType}' was not computed by the IL scanner."; - Debug.Fail(message); - throw new ScannerFailedException(message); + throw new ScannerFailedException($"Dictionary layout of '{methodOrType}' was not computed by the IL scanner."); } return new PrecomputedDictionaryLayoutNode(methodOrType, layout.Slots, layout.DiscardedSlots); }