From f1127ff5bb0400be9163d1a03ef0ec9da928252b Mon Sep 17 00:00:00 2001 From: tmat Date: Mon, 30 Sep 2024 15:30:42 -0700 Subject: [PATCH] Improve error reporting when reading bad metadata during EnC --- .../CSharp/Portable/CSharpResources.resx | 2 +- .../Portable/xlf/CSharpResources.cs.xlf | 4 +- .../Portable/xlf/CSharpResources.de.xlf | 4 +- .../Portable/xlf/CSharpResources.es.xlf | 4 +- .../Portable/xlf/CSharpResources.fr.xlf | 4 +- .../Portable/xlf/CSharpResources.it.xlf | 4 +- .../Portable/xlf/CSharpResources.ja.xlf | 4 +- .../Portable/xlf/CSharpResources.ko.xlf | 4 +- .../Portable/xlf/CSharpResources.pl.xlf | 4 +- .../Portable/xlf/CSharpResources.pt-BR.xlf | 4 +- .../Portable/xlf/CSharpResources.ru.xlf | 4 +- .../Portable/xlf/CSharpResources.tr.xlf | 4 +- .../Portable/xlf/CSharpResources.zh-Hans.xlf | 4 +- .../Portable/xlf/CSharpResources.zh-Hant.xlf | 4 +- .../EditAndContinue/EditAndContinueTests.cs | 73 +++++++------------ .../Emit/EditAndContinue/DefinitionMap.cs | 10 ++- .../VisualBasic/Portable/VBResources.resx | 2 +- .../Portable/xlf/VBResources.cs.xlf | 4 +- .../Portable/xlf/VBResources.de.xlf | 4 +- .../Portable/xlf/VBResources.es.xlf | 4 +- .../Portable/xlf/VBResources.fr.xlf | 4 +- .../Portable/xlf/VBResources.it.xlf | 4 +- .../Portable/xlf/VBResources.ja.xlf | 4 +- .../Portable/xlf/VBResources.ko.xlf | 4 +- .../Portable/xlf/VBResources.pl.xlf | 4 +- .../Portable/xlf/VBResources.pt-BR.xlf | 4 +- .../Portable/xlf/VBResources.ru.xlf | 4 +- .../Portable/xlf/VBResources.tr.xlf | 4 +- .../Portable/xlf/VBResources.zh-Hans.xlf | 4 +- .../Portable/xlf/VBResources.zh-Hant.xlf | 4 +- .../EditAndContinue/EditAndContinueTests.vb | 37 ++++++++++ .../EditAndContinue/EditAndContinueTest.cs | 4 +- 32 files changed, 127 insertions(+), 105 deletions(-) diff --git a/src/Compilers/CSharp/Portable/CSharpResources.resx b/src/Compilers/CSharp/Portable/CSharpResources.resx index 05651836cd26..4210d8664c20 100644 --- a/src/Compilers/CSharp/Portable/CSharpResources.resx +++ b/src/Compilers/CSharp/Portable/CSharpResources.resx @@ -5876,7 +5876,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ Local function '{0}' must declare a body because it is not marked 'static extern'. - Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}' + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} {0} is not a valid C# conversion expression diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf index eee2fcf6dbd3..97f38a0ba297 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf @@ -12995,8 +12995,8 @@ Pokud chcete odstranit toto varování, můžete místo toho použít /reference - Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}' - Informace o ladění metody {0} (token 0x{1:X8}) ze sestavení {2} nelze přečíst. + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf index c135d9caf1b8..468849abccb2 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf @@ -12995,8 +12995,8 @@ Um die Warnung zu beheben, können Sie stattdessen /reference verwenden (Einbett - Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}' - Die Debuginformationen der Methode "{0}" (Token 0x{1:X8}) können nicht aus der Assembly "{2}" gelesen werden. + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf index 8ec6e1e97821..74018115a0db 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf @@ -12995,8 +12995,8 @@ Para eliminar la advertencia puede usar /reference (establezca la propiedad Embe - Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}' - No se puede leer la información de depuración del método "{0}" (token 0x{1:X8}) desde el ensamblado "{2}". + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf index 17ecad6fc40a..7c44fda3a6c3 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf @@ -12995,8 +12995,8 @@ Pour supprimer l'avertissement, vous pouvez utiliser la commande /reference (dé - Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}' - Impossible de lire les informations de débogage de la méthode '{0}' (jeton 0x{1:X8}) dans l'assembly '{2}' + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf index 665f0f29562d..dd5305891010 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf @@ -12995,8 +12995,8 @@ Per rimuovere l'avviso, è invece possibile usare /reference (impostare la propr - Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}' - Non è possibile leggere le informazione di debug del metodo '{0}' (token 0x{1:X8}) dall'assembly '{2}' + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf index 5f8a0d462468..c213b1b04fbb 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf @@ -12995,8 +12995,8 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ - Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}' - メソッド '{0}' (トークン 0x{1:X8}) のデバッグ情報をアセンブリ '{2}' から読み取ることができません + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf index f771075e2cf4..d6899541383d 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf @@ -12995,8 +12995,8 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ - Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}' - '{2}' 어셈블리에서 '{0}' 메서드(토큰 0x{1:X8})의 디버그 정보를 읽을 수 없습니다. + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf index 1c0cddc68df8..5c458d527c81 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf @@ -12995,8 +12995,8 @@ Aby usunąć ostrzeżenie, możesz zamiast tego użyć opcji /reference (ustaw w - Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}' - Nie można odczytać informacji debugowania metody „{0}” (token 0x{1:X8}) z zestawu „{2}” + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf index 58481a950d63..51eef0d8b5df 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf @@ -12995,8 +12995,8 @@ Para incorporar informações de tipo de interoperabilidade para os dois assembl - Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}' - Não é possível ler as informações de depuração do método '{0}' (token 0x{1:X8}) do assembly '{2}' + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf index bc19ec085d4f..4a5982ce97c7 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf @@ -12996,8 +12996,8 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ - Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}' - Не удается считать сведения об отладке метода "{0}" (маркер 0x{1:X8}) из сборки "{2}". + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf index 5ea2a59ff869..03a885df7674 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf @@ -12995,8 +12995,8 @@ Uyarıyı kaldırmak için, /reference kullanabilirsiniz (Birlikte Çalışma T - Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}' - '{2}' bütünleştirilmiş kodundan '{0}' metodunun hata ayıklama bilgileri okunamıyor (belirteç 0x{1:X8}) + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf index 9ade523f862d..2a6bb852177e 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf @@ -12995,8 +12995,8 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ - Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}' - 无法从程序集“{2}”读取方法“{0}”(令牌 0x{1:X8})的调试信息 + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} diff --git a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf index 1acf277c7b04..87cf0d7f7212 100644 --- a/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf +++ b/src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf @@ -12995,8 +12995,8 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ - Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}' - 無法從組件 '{2}' 讀取方法 '{0}' 的偵錯資訊 (權杖 0x{1:X8}) + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} diff --git a/src/Compilers/CSharp/Test/Emit2/Emit/EditAndContinue/EditAndContinueTests.cs b/src/Compilers/CSharp/Test/Emit2/Emit/EditAndContinue/EditAndContinueTests.cs index 7ca93cc1868a..ce58d22354c8 100644 --- a/src/Compilers/CSharp/Test/Emit2/Emit/EditAndContinue/EditAndContinueTests.cs +++ b/src/Compilers/CSharp/Test/Emit2/Emit/EditAndContinue/EditAndContinueTests.cs @@ -12760,52 +12760,35 @@ public void ManyGenerations() } } + [Theory] + [InlineData(typeof(IOException))] + [InlineData(typeof(BadImageFormatException))] + [InlineData(typeof(InvalidDataException))] [WorkItem(187868, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/187868")] - [Fact] - public void PdbReadingErrors() + public void SymReaderErrors(Type exceptionType) { - var source0 = MarkedSource(@" -using System; - -class C -{ - static void F() - { - Console.WriteLine(1); - } -}"); - - var source1 = MarkedSource(@" -using System; - -class C -{ - static void F() - { - Console.WriteLine(2); - } -}"); - var compilation0 = CreateCompilation(source0.Tree, options: TestOptions.DebugDll, assemblyName: "PdbReadingErrorsAssembly"); - var compilation1 = compilation0.WithSource(source1.Tree); - - var v0 = CompileAndVerify(compilation0); - var md0 = ModuleMetadata.CreateFromImage(v0.EmittedAssemblyData); - - var f0 = compilation0.GetMember("C.F"); - var f1 = compilation1.GetMember("C.F"); - - var generation0 = CreateInitialBaseline(compilation0, md0, methodHandle => - { - throw new InvalidDataException("Bad PDB!"); - }); - - var diff1 = compilation1.EmitDifference( - generation0, - ImmutableArray.Create(SemanticEdit.Create(SemanticEditKind.Update, f0, f1, GetSyntaxMapFromMarkers(source0, source1)))); - - diff1.EmitResult.Diagnostics.Verify( - // (6,14): error CS7038: Failed to emit module 'Unable to read debug information of method 'C.F()' (token 0x06000001) from assembly 'PdbReadingErrorsAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null''. - Diagnostic(ErrorCode.ERR_InvalidDebugInfo, "F").WithArguments("C.F()", "100663297", "PdbReadingErrorsAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null").WithLocation(6, 14)); + using var _ = new EditAndContinueTest(assemblyName: "test") + .AddBaseline( + """ + class C { void F() { int x = 1; } } + """, + debugInformationProvider: _ => throw (Exception)Activator.CreateInstance(exceptionType, ["bug!"])) + .AddGeneration( + // 1 + """ + class C { void F() { int x = 2; } } + """, + edits: + [ + Edit(SemanticEditKind.Update, c => c.GetMember("C.F"), preserveLocalVariables: true) + ], + expectedErrors: + [ + // (1,16): error CS7103: Unable to read debug information of method 'C.F()' (token 0x06000001) from assembly 'test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null': bug! + // class C { void F() { int x = 2; } } + Diagnostic(ErrorCode.ERR_InvalidDebugInfo, "F").WithArguments("C.F()", "100663297", "test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "bug!").WithLocation(1, 16) + ]) + .Verify(); } [Fact] @@ -12846,7 +12829,7 @@ static void F() throw new ArgumentOutOfRangeException(); }); - // the compiler should't swallow any exceptions but InvalidDataException + // the compiler should't swallow any exceptions but InvalidDataException, IOException and BadImageFormatException Assert.Throws(() => compilation1.EmitDifference( generation0, diff --git a/src/Compilers/Core/Portable/Emit/EditAndContinue/DefinitionMap.cs b/src/Compilers/Core/Portable/Emit/EditAndContinue/DefinitionMap.cs index 71ccffc9bb06..4e8e15699e12 100644 --- a/src/Compilers/Core/Portable/Emit/EditAndContinue/DefinitionMap.cs +++ b/src/Compilers/Core/Portable/Emit/EditAndContinue/DefinitionMap.cs @@ -291,14 +291,15 @@ protected abstract void GetStateMachineFieldMapFromMetadata( debugInfo = Baseline.DebugInformationProvider(methodHandle); localSignature = Baseline.LocalSignatureProvider(methodHandle); } - catch (Exception e) when (e is InvalidDataException or IOException) + catch (Exception e) when (e is InvalidDataException or IOException or BadImageFormatException) { diagnostics.Add(MessageProvider.CreateDiagnostic( MessageProvider.ERR_InvalidDebugInfo, method.Locations.First(), method, MetadataTokens.GetToken(methodHandle), - method.ContainingAssembly + method.ContainingAssembly, + e.Message )); return null; @@ -382,7 +383,8 @@ protected abstract void GetStateMachineFieldMapFromMetadata( method.Locations.First(), method, MetadataTokens.GetToken(localSignature), - method.ContainingAssembly + method.ContainingAssembly, + e.Message )); return null; @@ -690,7 +692,7 @@ static ImmutableArray getHoistedVariableNames(ImmutableArrayType is for evaluation purposes only and is subject to change or removal in future updates. - Unable to read debug information of method '{0}' (token 0x{1}) from assembly '{2}' + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} {0} is not a valid Visual Basic conversion expression diff --git a/src/Compilers/VisualBasic/Portable/xlf/VBResources.cs.xlf b/src/Compilers/VisualBasic/Portable/xlf/VBResources.cs.xlf index 304313d729ee..58a67c5e5dee 100644 --- a/src/Compilers/VisualBasic/Portable/xlf/VBResources.cs.xlf +++ b/src/Compilers/VisualBasic/Portable/xlf/VBResources.cs.xlf @@ -9322,8 +9322,8 @@ - Unable to read debug information of method '{0}' (token 0x{1}) from assembly '{2}' - Informace o ladění metody {0} (token 0x{1}) ze sestavení {2} nelze přečíst. + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} diff --git a/src/Compilers/VisualBasic/Portable/xlf/VBResources.de.xlf b/src/Compilers/VisualBasic/Portable/xlf/VBResources.de.xlf index 0a1911c0b846..9e9ed4cc30aa 100644 --- a/src/Compilers/VisualBasic/Portable/xlf/VBResources.de.xlf +++ b/src/Compilers/VisualBasic/Portable/xlf/VBResources.de.xlf @@ -9322,8 +9322,8 @@ - Unable to read debug information of method '{0}' (token 0x{1}) from assembly '{2}' - Die Debuginformationen der Methode "{0}" (Token 0x{1}) können nicht aus der Assembly "{2}" gelesen werden. + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} diff --git a/src/Compilers/VisualBasic/Portable/xlf/VBResources.es.xlf b/src/Compilers/VisualBasic/Portable/xlf/VBResources.es.xlf index 2127f5023673..edd7d212905a 100644 --- a/src/Compilers/VisualBasic/Portable/xlf/VBResources.es.xlf +++ b/src/Compilers/VisualBasic/Portable/xlf/VBResources.es.xlf @@ -9322,8 +9322,8 @@ - Unable to read debug information of method '{0}' (token 0x{1}) from assembly '{2}' - No se puede leer la información de depuración del método "{0}" (token 0x{1}) desde el ensamblado "{2}" + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} diff --git a/src/Compilers/VisualBasic/Portable/xlf/VBResources.fr.xlf b/src/Compilers/VisualBasic/Portable/xlf/VBResources.fr.xlf index 65c6b056e341..e9940a1be752 100644 --- a/src/Compilers/VisualBasic/Portable/xlf/VBResources.fr.xlf +++ b/src/Compilers/VisualBasic/Portable/xlf/VBResources.fr.xlf @@ -9322,8 +9322,8 @@ - Unable to read debug information of method '{0}' (token 0x{1}) from assembly '{2}' - Impossible de lire les informations de débogage de la méthode '{0}' (jeton 0x{1}) dans l'assembly '{2}' + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} diff --git a/src/Compilers/VisualBasic/Portable/xlf/VBResources.it.xlf b/src/Compilers/VisualBasic/Portable/xlf/VBResources.it.xlf index 635b27782f5f..1115589772d4 100644 --- a/src/Compilers/VisualBasic/Portable/xlf/VBResources.it.xlf +++ b/src/Compilers/VisualBasic/Portable/xlf/VBResources.it.xlf @@ -9323,8 +9323,8 @@ - Unable to read debug information of method '{0}' (token 0x{1}) from assembly '{2}' - Non è possibile leggere le informazione di debug del metodo '{0}' (token 0x{1}) dall'assembly '{2}' + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} diff --git a/src/Compilers/VisualBasic/Portable/xlf/VBResources.ja.xlf b/src/Compilers/VisualBasic/Portable/xlf/VBResources.ja.xlf index ffd2ebd423d0..dd1aeb31ff17 100644 --- a/src/Compilers/VisualBasic/Portable/xlf/VBResources.ja.xlf +++ b/src/Compilers/VisualBasic/Portable/xlf/VBResources.ja.xlf @@ -9324,8 +9324,8 @@ - Unable to read debug information of method '{0}' (token 0x{1}) from assembly '{2}' - メソッド '{0}' (トークン 0x{1}) のデバッグ情報をアセンブリ '{2}' から読み取ることができません + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} diff --git a/src/Compilers/VisualBasic/Portable/xlf/VBResources.ko.xlf b/src/Compilers/VisualBasic/Portable/xlf/VBResources.ko.xlf index b2257db8b9c4..7810d8be0498 100644 --- a/src/Compilers/VisualBasic/Portable/xlf/VBResources.ko.xlf +++ b/src/Compilers/VisualBasic/Portable/xlf/VBResources.ko.xlf @@ -9322,8 +9322,8 @@ - Unable to read debug information of method '{0}' (token 0x{1}) from assembly '{2}' - '{2}' 어셈블리에서 '{0}' 메서드(토큰 0x{1})의 디버그 정보를 읽을 수 없습니다. + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} diff --git a/src/Compilers/VisualBasic/Portable/xlf/VBResources.pl.xlf b/src/Compilers/VisualBasic/Portable/xlf/VBResources.pl.xlf index ad8888b59af2..07f875f3c381 100644 --- a/src/Compilers/VisualBasic/Portable/xlf/VBResources.pl.xlf +++ b/src/Compilers/VisualBasic/Portable/xlf/VBResources.pl.xlf @@ -9322,8 +9322,8 @@ - Unable to read debug information of method '{0}' (token 0x{1}) from assembly '{2}' - Nie można odczytać informacji debugowania metody „{0}” (token 0x{1}) z zestawu „{2}” + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} diff --git a/src/Compilers/VisualBasic/Portable/xlf/VBResources.pt-BR.xlf b/src/Compilers/VisualBasic/Portable/xlf/VBResources.pt-BR.xlf index 326b711d341d..80f5bd687e3e 100644 --- a/src/Compilers/VisualBasic/Portable/xlf/VBResources.pt-BR.xlf +++ b/src/Compilers/VisualBasic/Portable/xlf/VBResources.pt-BR.xlf @@ -9322,8 +9322,8 @@ - Unable to read debug information of method '{0}' (token 0x{1}) from assembly '{2}' - Não é possível ler as informações de depuração do método '{0}' (token 0x{1}) do assembly '{2}' + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} diff --git a/src/Compilers/VisualBasic/Portable/xlf/VBResources.ru.xlf b/src/Compilers/VisualBasic/Portable/xlf/VBResources.ru.xlf index 017ce109edae..09bf20a17809 100644 --- a/src/Compilers/VisualBasic/Portable/xlf/VBResources.ru.xlf +++ b/src/Compilers/VisualBasic/Portable/xlf/VBResources.ru.xlf @@ -9322,8 +9322,8 @@ optionstrict[+|-] Принудительное применени - Unable to read debug information of method '{0}' (token 0x{1}) from assembly '{2}' - Не удается считать сведения об отладке метода "{0}" (маркер 0x{1}) из сборки "{2}". + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} diff --git a/src/Compilers/VisualBasic/Portable/xlf/VBResources.tr.xlf b/src/Compilers/VisualBasic/Portable/xlf/VBResources.tr.xlf index 7aa5d0237f74..68462011b0d1 100644 --- a/src/Compilers/VisualBasic/Portable/xlf/VBResources.tr.xlf +++ b/src/Compilers/VisualBasic/Portable/xlf/VBResources.tr.xlf @@ -9323,8 +9323,8 @@ - Unable to read debug information of method '{0}' (token 0x{1}) from assembly '{2}' - '{2}' bütünleştirilmiş kodundan '{0}' (simge 0 x{1}) metodunun hata ayıklama bilgileri okunamıyor + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} diff --git a/src/Compilers/VisualBasic/Portable/xlf/VBResources.zh-Hans.xlf b/src/Compilers/VisualBasic/Portable/xlf/VBResources.zh-Hans.xlf index 7bcecef5c4da..76bc9c7093c0 100644 --- a/src/Compilers/VisualBasic/Portable/xlf/VBResources.zh-Hans.xlf +++ b/src/Compilers/VisualBasic/Portable/xlf/VBResources.zh-Hans.xlf @@ -9322,8 +9322,8 @@ - Unable to read debug information of method '{0}' (token 0x{1}) from assembly '{2}' - 无法从程序集“{2}”读取方法“{0}”(令牌 0x{1})的调试信息 + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} diff --git a/src/Compilers/VisualBasic/Portable/xlf/VBResources.zh-Hant.xlf b/src/Compilers/VisualBasic/Portable/xlf/VBResources.zh-Hant.xlf index 00c4c813eb6d..de5cea83ecad 100644 --- a/src/Compilers/VisualBasic/Portable/xlf/VBResources.zh-Hant.xlf +++ b/src/Compilers/VisualBasic/Portable/xlf/VBResources.zh-Hant.xlf @@ -9323,8 +9323,8 @@ - Unable to read debug information of method '{0}' (token 0x{1}) from assembly '{2}' - 無法從組件 '{2}' 讀取方法 '{0}' 的偵錯資訊 (權杖 0x{1}) + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} + Unable to read debug information of method '{0}' (token 0x{1:X8}) from assembly '{2}': {3} diff --git a/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.vb b/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.vb index 8b2d535fa2e9..7fa811e5b6e8 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.vb @@ -20,6 +20,43 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests Public Class EditAndContinueTests Inherits EditAndContinueTestBase + + + + + Public Sub SymReaderErrors(exceptionType As Type) + Using New EditAndContinueTest(assemblyName:="test"). + AddBaseline( + source:=" + Class C + Sub F() + Dim x = 1 + End Sub + End Class + ", + debugInformationProvider:=Function(method) + Throw DirectCast(Activator.CreateInstance(exceptionType, {"bug!"}), Exception) + End Function). + AddGeneration(' 1 + source:=" + Class C + Sub F() + Dim x = 2 + End Sub + End Class + ", + edits:= + { + Edit(SemanticEditKind.Update, Function(c) c.GetMember("C.F"), preserveLocalVariables:=True) + }, + expectedErrors:= + { + Diagnostic(ERRID.ERR_InvalidDebugInfo, "F").WithArguments("Public Sub F()", &H6000002, "test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "bug!").WithLocation(3, 29) + }). + Verify() + End Using + End Sub + Public Sub SemanticErrors_MethodBody() Dim source0 = MarkedSource(" diff --git a/src/Test/PdbUtilities/EditAndContinue/EditAndContinueTest.cs b/src/Test/PdbUtilities/EditAndContinue/EditAndContinueTest.cs index 5a370e2ac41f..f51868ce67ea 100644 --- a/src/Test/PdbUtilities/EditAndContinue/EditAndContinueTest.cs +++ b/src/Test/PdbUtilities/EditAndContinue/EditAndContinueTest.cs @@ -35,7 +35,7 @@ internal abstract partial class EditAndContinueTest(ITestOutputHelper? ou private TSelf This => (TSelf)this; - internal TSelf AddBaseline(string source, Action? validator = null) + internal TSelf AddBaseline(string source, Action? validator = null, Func? debugInformationProvider = null) { _hasVerified = false; @@ -62,7 +62,7 @@ internal TSelf AddBaseline(string source, Action? validator var md = ModuleMetadata.CreateFromImage(verifier.EmittedAssemblyData); _disposables.Add(md); - var baseline = EditAndContinueTestUtilities.CreateInitialBaseline(compilation, md, verifier.CreateSymReader().GetEncMethodDebugInfo); + var baseline = EditAndContinueTestUtilities.CreateInitialBaseline(compilation, md, debugInformationProvider ?? verifier.CreateSymReader().GetEncMethodDebugInfo); _generations.Add(new GenerationInfo(compilation, md.MetadataReader, diff: null, verifier, baseline, validator ?? new(x => { }))); _sources.Add(markedSource);