From fab958dcf325ee60d2163b2c50725110a755f62e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Matou=C5=A1ek?= Date: Tue, 17 May 2016 18:34:42 -0700 Subject: [PATCH] Improve and localize EnC error message (#11381) --- .../CSharp/Portable/CSharpResources.Designer.cs | 9 +++++++++ .../CSharp/Portable/CSharpResources.resx | 3 +++ .../CSharp/Portable/Errors/ErrorCode.cs | 1 + .../CSharp/Portable/Errors/MessageProvider.cs | 3 ++- .../EditAndContinueStateMachineTests.cs | 12 ++++++------ .../Test/Syntax/Diagnostics/DiagnosticTest.cs | 4 ++-- .../Portable/CodeAnalysisResources.Designer.cs | 9 +++++++++ .../Core/Portable/CodeAnalysisResources.resx | 3 +++ .../Portable/Diagnostic/CommonMessageProvider.cs | 5 +++-- .../Core/Portable/Diagnostic/DiagnosticInfo.cs | 2 +- .../EditAndContinue/EncVariableSlotAllocator.cs | 16 ++++++++++++---- .../Core/Portable/FileSystem/FileUtilities.cs | 4 +--- .../CommonReferenceManager.State.cs | 4 ++-- .../VisualBasic/Portable/Errors/Errors.vb | 1 + .../Portable/Errors/MessageProvider.vb | 8 +++++++- .../VisualBasic/Portable/VBResources.Designer.vb | 9 +++++++++ .../VisualBasic/Portable/VBResources.resx | 3 +++ .../EditAndContinueStateMachineTests.vb | 6 +++--- .../Test/Syntax/Syntax/GeneratedTests.vb | 4 ++-- .../VisualBasic/Test/Syntax/TestSyntaxNodes.vb | 4 ++-- .../RudeEditDiagnosticDescriptors.cs | 4 +--- .../Core/Portable/FeaturesResources.Designer.cs | 9 +++++++++ .../Core/Portable/FeaturesResources.resx | 3 +++ .../Shared/Mocks/TestMessageProvider.cs | 8 ++++++++ 24 files changed, 102 insertions(+), 32 deletions(-) diff --git a/src/Compilers/CSharp/Portable/CSharpResources.Designer.cs b/src/Compilers/CSharp/Portable/CSharpResources.Designer.cs index 155950099ab..3e022eb5626 100644 --- a/src/Compilers/CSharp/Portable/CSharpResources.Designer.cs +++ b/src/Compilers/CSharp/Portable/CSharpResources.Designer.cs @@ -3517,6 +3517,15 @@ internal class CSharpResources { } } + /// + /// Looks up a localized string similar to Cannot update '{0}'; attribute '{1}' is missing.. + /// + internal static string ERR_EncUpdateFailedMissingAttribute { + get { + return ResourceManager.GetString("ERR_EncUpdateFailedMissingAttribute", resourceCulture); + } + } + /// /// Looks up a localized string similar to #endif directive expected. /// diff --git a/src/Compilers/CSharp/Portable/CSharpResources.resx b/src/Compilers/CSharp/Portable/CSharpResources.resx index f053ebac9b7..32f2d691b09 100644 --- a/src/Compilers/CSharp/Portable/CSharpResources.resx +++ b/src/Compilers/CSharp/Portable/CSharpResources.resx @@ -3833,6 +3833,9 @@ You should consider suppressing the warning only if you're sure that you don't w Cannot use fixed local '{0}' inside an anonymous method, lambda expression, or query expression + + Cannot update '{0}'; attribute '{1}' is missing. + An expression tree may not contain a named argument specification diff --git a/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs b/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs index b0d2a1c103b..9c303ef8934 100644 --- a/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs +++ b/src/Compilers/CSharp/Portable/Errors/ErrorCode.cs @@ -1174,6 +1174,7 @@ internal enum ErrorCode // ERR_NameIllegallyOverrides3 = 7040, // Not used anymore due to 'Single Meaning' relaxation changes ERR_ResourceFileNameNotUnique = 7041, ERR_DllImportOnGenericMethod = 7042, + ERR_EncUpdateFailedMissingAttribute = 7043, ERR_ParameterNotValidForType = 7045, ERR_AttributeParameterRequired1 = 7046, diff --git a/src/Compilers/CSharp/Portable/Errors/MessageProvider.cs b/src/Compilers/CSharp/Portable/Errors/MessageProvider.cs index 68f9753fea4..bfd94287cce 100644 --- a/src/Compilers/CSharp/Portable/Errors/MessageProvider.cs +++ b/src/Compilers/CSharp/Portable/Errors/MessageProvider.cs @@ -95,7 +95,7 @@ public override Diagnostic CreateDiagnostic(int code, Location location, params return new CSDiagnostic(info, location); } - public override string ConvertSymbolToString(int errorCode, ISymbol symbol) + public override string GetErrorDisplayString(ISymbol symbol) { // show extra info for assembly if possible such as version, public key token etc. if (symbol.Kind == SymbolKind.Assembly || symbol.Kind == SymbolKind.Namespace) @@ -205,6 +205,7 @@ public override void ReportDuplicateMetadataReferenceWeak(DiagnosticBag diagnost public override int ERR_TooManyUserStrings { get { return (int)ErrorCode.ERR_TooManyUserStrings; } } public override int ERR_PeWritingFailure { get { return (int)ErrorCode.ERR_PeWritingFailure; } } public override int ERR_ModuleEmitFailure { get { return (int)ErrorCode.ERR_ModuleEmitFailure; } } + public override int ERR_EncUpdateFailedMissingAttribute { get { return (int)ErrorCode.ERR_EncUpdateFailedMissingAttribute; } } public override void ReportInvalidAttributeArgument(DiagnosticBag diagnostics, SyntaxNode attributeSyntax, int parameterIndex, AttributeData attribute) { diff --git a/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueStateMachineTests.cs b/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueStateMachineTests.cs index 206c4255744..4ae07c8d494 100644 --- a/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueStateMachineTests.cs +++ b/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueStateMachineTests.cs @@ -4756,8 +4756,8 @@ public IEnumerable F() new SemanticEdit(SemanticEditKind.Update, f0, f1, GetSyntaxMapFromMarkers(source0, source1), preserveLocalVariables: true))); diff1.EmitResult.Diagnostics.Verify( - // error CS7038: Failed to emit module '{0}'. - Diagnostic(ErrorCode.ERR_ModuleEmitFailure).WithArguments(compilation0.SourceModule.Name)); + // error CS7043: Cannot update 'C.F()'; attribute 'System.Runtime.CompilerServices.IteratorStateMachineAttribute' is missing. + Diagnostic(ErrorCode.ERR_EncUpdateFailedMissingAttribute).WithArguments("C.F()", "System.Runtime.CompilerServices.IteratorStateMachineAttribute")); } [Fact, WorkItem(9119, "https://github.com/dotnet/roslyn/issues/9119")] @@ -4811,10 +4811,10 @@ public async Task F() new SemanticEdit(SemanticEditKind.Update, f0, f1, GetSyntaxMapFromMarkers(source0, source1), preserveLocalVariables: true))); diff1.EmitResult.Diagnostics.Verify( - // error CS7038: Failed to emit module '{0}'. - Diagnostic(ErrorCode.ERR_ModuleEmitFailure).WithArguments(compilation0.SourceModule.Name), - // error CS7038: Failed to emit module '{0}'. - Diagnostic(ErrorCode.ERR_ModuleEmitFailure).WithArguments(compilation0.SourceModule.Name)); + // error CS7043: Cannot update 'C.F()'; attribute 'System.Runtime.CompilerServices.AsyncStateMachineAttribute' is missing. + Diagnostic(ErrorCode.ERR_EncUpdateFailedMissingAttribute).WithArguments("C.F()", "System.Runtime.CompilerServices.AsyncStateMachineAttribute"), + // error CS7043: Cannot update 'C.F()'; attribute 'System.Runtime.CompilerServices.AsyncStateMachineAttribute' is missing. + Diagnostic(ErrorCode.ERR_EncUpdateFailedMissingAttribute).WithArguments("C.F()", "System.Runtime.CompilerServices.AsyncStateMachineAttribute")); } } } diff --git a/src/Compilers/CSharp/Test/Syntax/Diagnostics/DiagnosticTest.cs b/src/Compilers/CSharp/Test/Syntax/Diagnostics/DiagnosticTest.cs index 57b84c16767..60f4130d5f8 100644 --- a/src/Compilers/CSharp/Test/Syntax/Diagnostics/DiagnosticTest.cs +++ b/src/Compilers/CSharp/Test/Syntax/Diagnostics/DiagnosticTest.cs @@ -2226,9 +2226,9 @@ public override int GetWarningLevel(int code) } } - public override string ConvertSymbolToString(int errorCode, ISymbol symbol) + public override string GetErrorDisplayString(ISymbol symbol) { - return MessageProvider.Instance.ConvertSymbolToString(errorCode, symbol); + return MessageProvider.Instance.GetErrorDisplayString(symbol); } } diff --git a/src/Compilers/Core/Portable/CodeAnalysisResources.Designer.cs b/src/Compilers/Core/Portable/CodeAnalysisResources.Designer.cs index 27792ee2c91..79b3ad36c5e 100644 --- a/src/Compilers/Core/Portable/CodeAnalysisResources.Designer.cs +++ b/src/Compilers/Core/Portable/CodeAnalysisResources.Designer.cs @@ -314,6 +314,15 @@ internal class CodeAnalysisResources { } } + /// + /// Looks up a localized string similar to The compilation references multiple assemblies whose versions only differ in auto-generated build and/or revision numbers.. + /// + internal static string CompilationReferencesAssembliesWithDifferentAutoGeneratedVersion { + get { + return ResourceManager.GetString("CompilationReferencesAssembliesWithDifferentAutoGeneratedVersion", resourceCulture); + } + } + /// /// Looks up a localized string similar to Analyzer Failure. /// diff --git a/src/Compilers/Core/Portable/CodeAnalysisResources.resx b/src/Compilers/Core/Portable/CodeAnalysisResources.resx index 10c2ef376aa..8f1fde86ab5 100644 --- a/src/Compilers/Core/Portable/CodeAnalysisResources.resx +++ b/src/Compilers/Core/Portable/CodeAnalysisResources.resx @@ -516,4 +516,7 @@ Feature 'IOperation' is disabled. + + The compilation references multiple assemblies whose versions only differ in auto-generated build and/or revision numbers. + \ No newline at end of file diff --git a/src/Compilers/Core/Portable/Diagnostic/CommonMessageProvider.cs b/src/Compilers/Core/Portable/Diagnostic/CommonMessageProvider.cs index 3754056736e..1db72196394 100644 --- a/src/Compilers/Core/Portable/Diagnostic/CommonMessageProvider.cs +++ b/src/Compilers/Core/Portable/Diagnostic/CommonMessageProvider.cs @@ -86,9 +86,9 @@ public Diagnostic CreateDiagnostic(int code, Location location) public abstract string GetMessagePrefix(string id, DiagnosticSeverity severity, bool isWarningAsError, CultureInfo culture); /// - /// convert given symbol to string representation based on given error code + /// Convert given symbol to string representation. /// - public abstract string ConvertSymbolToString(int errorCode, ISymbol symbol); + public abstract string GetErrorDisplayString(ISymbol symbol); /// /// Given an error code (like 1234) return the identifier (CS1234 or BC1234). @@ -206,6 +206,7 @@ public DiagnosticInfo FilterDiagnosticInfo(DiagnosticInfo diagnosticInfo, Compil public abstract int ERR_TooManyUserStrings { get; } public abstract int ERR_PeWritingFailure { get; } public abstract int ERR_ModuleEmitFailure { get; } + public abstract int ERR_EncUpdateFailedMissingAttribute { get; } public abstract void ReportInvalidAttributeArgument(DiagnosticBag diagnostics, SyntaxNode attributeSyntax, int parameterIndex, AttributeData attribute); public abstract void ReportInvalidNamedArgument(DiagnosticBag diagnostics, SyntaxNode attributeSyntax, int namedArgumentIndex, ITypeSymbol attributeClass, string parameterName); diff --git a/src/Compilers/Core/Portable/Diagnostic/DiagnosticInfo.cs b/src/Compilers/Core/Portable/Diagnostic/DiagnosticInfo.cs index e8092585d76..035a9e55de5 100644 --- a/src/Compilers/Core/Portable/Diagnostic/DiagnosticInfo.cs +++ b/src/Compilers/Core/Portable/Diagnostic/DiagnosticInfo.cs @@ -356,7 +356,7 @@ protected object[] GetArgumentsToUse(IFormatProvider formatProvider) if (symbol != null) { argumentsToUse = InitializeArgumentListIfNeeded(argumentsToUse); - argumentsToUse[i] = _messageProvider.ConvertSymbolToString(_errorCode, symbol); + argumentsToUse[i] = _messageProvider.GetErrorDisplayString(symbol); } } diff --git a/src/Compilers/Core/Portable/Emit/EditAndContinue/EncVariableSlotAllocator.cs b/src/Compilers/Core/Portable/Emit/EditAndContinue/EncVariableSlotAllocator.cs index 18cf8b2c501..f513f4fe6bc 100644 --- a/src/Compilers/Core/Portable/Emit/EditAndContinue/EncVariableSlotAllocator.cs +++ b/src/Compilers/Core/Portable/Emit/EditAndContinue/EncVariableSlotAllocator.cs @@ -194,8 +194,7 @@ private bool TryGetPreviousLocalId(SyntaxNode currentDeclarator, LocalDebugId cu // Should rarely happen since the IDE reports a rude edit if the attribute type doesn't exist. if (_hoistedLocalSlotsOpt == null) { - // TODO: better error message https://github.com/dotnet/roslyn/issues/9196 - diagnostics.Add(_messageProvider.CreateDiagnostic(_messageProvider.ERR_ModuleEmitFailure, NoLocation.Singleton, _previousTopLevelMethod.ContainingModule.Name)); + ReportMissingStateMachineAttribute(diagnostics); slotIndex = -1; return false; } @@ -230,8 +229,7 @@ public override bool TryGetPreviousAwaiterSlotIndex(Cci.ITypeReference currentTy // Should rarely happen since the IDE reports a rude edit if the attribute type doesn't exist. if (_awaiterMapOpt == null) { - // TODO: better error message https://github.com/dotnet/roslyn/issues/9196 - diagnostics.Add(_messageProvider.CreateDiagnostic(_messageProvider.ERR_ModuleEmitFailure, NoLocation.Singleton, _previousTopLevelMethod.ContainingModule.Name)); + ReportMissingStateMachineAttribute(diagnostics); slotIndex = -1; return false; } @@ -239,6 +237,16 @@ public override bool TryGetPreviousAwaiterSlotIndex(Cci.ITypeReference currentTy return _awaiterMapOpt.TryGetValue(_symbolMap.MapReference(currentType), out slotIndex); } + private void ReportMissingStateMachineAttribute(DiagnosticBag diagnostics) + { + diagnostics.Add(_messageProvider.CreateDiagnostic( + _messageProvider.ERR_EncUpdateFailedMissingAttribute, + NoLocation.Singleton, + _messageProvider.GetErrorDisplayString(_previousTopLevelMethod), + (_previousTopLevelMethod.IsAsync ? AttributeDescription.AsyncStateMachineAttribute : AttributeDescription.IteratorStateMachineAttribute).FullName)); + } + + private bool TryGetPreviousSyntaxOffset(SyntaxNode currentSyntax, out int previousSyntaxOffset) { // no syntax map diff --git a/src/Compilers/Core/Portable/FileSystem/FileUtilities.cs b/src/Compilers/Core/Portable/FileSystem/FileUtilities.cs index 8e2502adf52..7f8f962fa7e 100644 --- a/src/Compilers/Core/Portable/FileSystem/FileUtilities.cs +++ b/src/Compilers/Core/Portable/FileSystem/FileUtilities.cs @@ -177,9 +177,7 @@ private static string ResolveRelativePath(PathKind kind, string path, string bas return path; default: - // EDMAURER this is not using ExceptionUtilities.UnexpectedValue() because this file - // is shared via linking with other code that doesn't have the ExceptionUtilities. - throw new InvalidOperationException(string.Format("Unexpected PathKind {0}.", kind)); + throw ExceptionUtilities.UnexpectedValue(kind); } } diff --git a/src/Compilers/Core/Portable/ReferenceManager/CommonReferenceManager.State.cs b/src/Compilers/Core/Portable/ReferenceManager/CommonReferenceManager.State.cs index 37a4c052a7c..acc32315c58 100644 --- a/src/Compilers/Core/Portable/ReferenceManager/CommonReferenceManager.State.cs +++ b/src/Compilers/Core/Portable/ReferenceManager/CommonReferenceManager.State.cs @@ -514,8 +514,8 @@ internal bool IsBound if (lazyBuilder.ContainsKey(sourceIdentity)) { - // TODO: localize message, report as diagnostic (https://github.com/dotnet/roslyn/issues/8910) - throw new NotSupportedException("The compilation references multiple assemblies whose versions only differ in auto-generated build and/or revision numbers."); + // The compilation references multiple assemblies whose versions only differ in auto-generated build and/or revision numbers. + throw new NotSupportedException(CodeAnalysisResources.CompilationReferencesAssembliesWithDifferentAutoGeneratedVersion); } lazyBuilder.Add(sourceIdentity, originalIdentity); diff --git a/src/Compilers/VisualBasic/Portable/Errors/Errors.vb b/src/Compilers/VisualBasic/Portable/Errors/Errors.vb index 737a3aef41a..58d43e89745 100644 --- a/src/Compilers/VisualBasic/Portable/Errors/Errors.vb +++ b/src/Compilers/VisualBasic/Portable/Errors/Errors.vb @@ -1605,6 +1605,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic ERR_PublicKeyContainerFailure = 36981 ERR_InvalidAssemblyCulture = 36982 + ERR_EncUpdateFailedMissingAttribute = 36983 ERR_CantAwaitAsyncSub1 = 37001 ERR_ResumableLambdaInExpressionTree = 37050 diff --git a/src/Compilers/VisualBasic/Portable/Errors/MessageProvider.vb b/src/Compilers/VisualBasic/Portable/Errors/MessageProvider.vb index 89a95f26099..4367c4ffbec 100644 --- a/src/Compilers/VisualBasic/Portable/Errors/MessageProvider.vb +++ b/src/Compilers/VisualBasic/Portable/Errors/MessageProvider.vb @@ -95,7 +95,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Return New VBDiagnostic(ErrorFactory.ErrorInfo(CType(code, ERRID), args), location) End Function - Public Overrides Function ConvertSymbolToString(errorCode As Integer, symbol As ISymbol) As String + Public Overrides Function GetErrorDisplayString(symbol As ISymbol) As String ' show extra info for assembly if possible such as version, public key token etc. If symbol.Kind = SymbolKind.Assembly OrElse symbol.Kind = SymbolKind.Namespace Then Return symbol.ToString() @@ -498,6 +498,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Return ERRID.ERR_ModuleEmitFailure End Get End Property + + Public Overrides ReadOnly Property ERR_EncUpdateFailedMissingAttribute As Integer + Get + Return ERRID.ERR_EncUpdateFailedMissingAttribute + End Get + End Property End Class End Namespace diff --git a/src/Compilers/VisualBasic/Portable/VBResources.Designer.vb b/src/Compilers/VisualBasic/Portable/VBResources.Designer.vb index c28b8679521..6b902099b55 100644 --- a/src/Compilers/VisualBasic/Portable/VBResources.Designer.vb +++ b/src/Compilers/VisualBasic/Portable/VBResources.Designer.vb @@ -3296,6 +3296,15 @@ Namespace Microsoft.CodeAnalysis.VisualBasic End Get End Property + ''' + ''' Looks up a localized string similar to Cannot update '{0}'; attribute '{1}' is missing.. + ''' + Friend ReadOnly Property ERR_EncUpdateFailedMissingAttribute() As String + Get + Return ResourceManager.GetString("ERR_EncUpdateFailedMissingAttribute", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to 'End Class' must be preceded by a matching 'Class'.. ''' diff --git a/src/Compilers/VisualBasic/Portable/VBResources.resx b/src/Compilers/VisualBasic/Portable/VBResources.resx index d029e112221..a78b63540b7 100644 --- a/src/Compilers/VisualBasic/Portable/VBResources.resx +++ b/src/Compilers/VisualBasic/Portable/VBResources.resx @@ -818,6 +818,9 @@ Failed to emit module '{0}'. + + Cannot update '{0}'; attribute '{1}' is missing. + {0} '{1}' cannot be declared 'Overrides' because it does not override a {0} in a base class. diff --git a/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueStateMachineTests.vb b/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueStateMachineTests.vb index acb7dbd0d76..786280bd434 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueStateMachineTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinue/EditAndContinueStateMachineTests.vb @@ -4447,7 +4447,7 @@ End Class ImmutableArray.Create(New SemanticEdit(SemanticEditKind.Update, f0, f1, GetSyntaxMapFromMarkers(source0, source1), preserveLocalVariables:=True))) diff1.EmitResult.Diagnostics.Verify( - Diagnostic(ERRID.ERR_ModuleEmitFailure).WithArguments(compilation0.SourceModule.Name)) + Diagnostic(ERRID.ERR_EncUpdateFailedMissingAttribute).WithArguments("Public Function F() As IEnumerable(Of Integer)", "System.Runtime.CompilerServices.IteratorStateMachineAttribute")) End Sub @@ -4501,8 +4501,8 @@ End Class ImmutableArray.Create(New SemanticEdit(SemanticEditKind.Update, f0, f1, GetSyntaxMapFromMarkers(source0, source1), preserveLocalVariables:=True))) diff1.EmitResult.Diagnostics.Verify( - Diagnostic(ERRID.ERR_ModuleEmitFailure).WithArguments(compilation0.SourceModule.Name), - Diagnostic(ERRID.ERR_ModuleEmitFailure).WithArguments(compilation0.SourceModule.Name)) + Diagnostic(ERRID.ERR_EncUpdateFailedMissingAttribute).WithArguments("Public Function F() As Task(Of Integer)", "System.Runtime.CompilerServices.AsyncStateMachineAttribute"), + Diagnostic(ERRID.ERR_EncUpdateFailedMissingAttribute).WithArguments("Public Function F() As Task(Of Integer)", "System.Runtime.CompilerServices.AsyncStateMachineAttribute")) End Sub End Class End Namespace diff --git a/src/Compilers/VisualBasic/Test/Syntax/Syntax/GeneratedTests.vb b/src/Compilers/VisualBasic/Test/Syntax/Syntax/GeneratedTests.vb index 14bf73ddd41..5f36fccee10 100644 --- a/src/Compilers/VisualBasic/Test/Syntax/Syntax/GeneratedTests.vb +++ b/src/Compilers/VisualBasic/Test/Syntax/Syntax/GeneratedTests.vb @@ -81,8 +81,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests Return String.Empty End Function - Public Overrides Function ConvertSymbolToString(errorCode As Integer, symbol As ISymbol) As String - Return MessageProvider.Instance.ConvertSymbolToString(errorCode, symbol) + Public Overrides Function GetErrorDisplayString(symbol As ISymbol) As String + Return MessageProvider.Instance.GetErrorDisplayString(symbol) End Function End Class diff --git a/src/Compilers/VisualBasic/Test/Syntax/TestSyntaxNodes.vb b/src/Compilers/VisualBasic/Test/Syntax/TestSyntaxNodes.vb index 4b02fecaf98..9d08ec45f46 100644 --- a/src/Compilers/VisualBasic/Test/Syntax/TestSyntaxNodes.vb +++ b/src/Compilers/VisualBasic/Test/Syntax/TestSyntaxNodes.vb @@ -1030,8 +1030,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests Return 0 End Function - Public Overrides Function ConvertSymbolToString(errorCode As Integer, symbol As ISymbol) As String - Return MessageProvider.Instance.ConvertSymbolToString(errorCode, symbol) + Public Overrides Function GetErrorDisplayString(symbol As ISymbol) As String + Return MessageProvider.Instance.GetErrorDisplayString(symbol) End Function End Class diff --git a/src/Features/Core/Portable/EditAndContinue/RudeEditDiagnosticDescriptors.cs b/src/Features/Core/Portable/EditAndContinue/RudeEditDiagnosticDescriptors.cs index 636a5d8d44e..d25904d9c2b 100644 --- a/src/Features/Core/Portable/EditAndContinue/RudeEditDiagnosticDescriptors.cs +++ b/src/Features/Core/Portable/EditAndContinue/RudeEditDiagnosticDescriptors.cs @@ -80,9 +80,7 @@ internal static class RudeEditDiagnosticDescriptors { GetDescriptorPair(RudeEditKind.PartiallyExecutedActiveStatementDelete, FeaturesResources.AnActiveStatementHasBeenRemoved) }, { GetDescriptorPair(RudeEditKind.InsertFile, FeaturesResources.AddingANewFile) }, { GetDescriptorPair(RudeEditKind.UpdatingStateMachineMethodAroundActiveStatement, FeaturesResources.UpdatingStateMachineMethodAroundActive) }, - // TODO: move message to resources https://github.com/dotnet/roslyn/issues/9196 - { GetDescriptorPair(RudeEditKind.UpdatingStateMachineMethodMissingAttribute, "Attribute '{0}' is missing. Updating an async method or an iterator will prevent the debug session from continuing.") }, - + { GetDescriptorPair(RudeEditKind.UpdatingStateMachineMethodMissingAttribute, FeaturesResources.UpdatingStateMachineMethodMissingAttribute) }, { GetDescriptorPair(RudeEditKind.RUDE_EDIT_COMPLEX_QUERY_EXPRESSION, FeaturesResources.ModifyingAWhichContainsComplexQuery) }, // VB specific, diff --git a/src/Features/Core/Portable/FeaturesResources.Designer.cs b/src/Features/Core/Portable/FeaturesResources.Designer.cs index d2d133a80f7..fb4f07271dd 100644 --- a/src/Features/Core/Portable/FeaturesResources.Designer.cs +++ b/src/Features/Core/Portable/FeaturesResources.Designer.cs @@ -2322,6 +2322,15 @@ internal class FeaturesResources { } } + /// + /// Looks up a localized string similar to Attribute '{0}' is missing. Updating an async method or an iterator will prevent the debug session from continuing.. + /// + internal static string UpdatingStateMachineMethodMissingAttribute { + get { + return ResourceManager.GetString("UpdatingStateMachineMethodMissingAttribute", resourceCulture); + } + } + /// /// Looks up a localized string similar to Updating the alias of Declare Statement will prevent the debug session from continuing.. /// diff --git a/src/Features/Core/Portable/FeaturesResources.resx b/src/Features/Core/Portable/FeaturesResources.resx index ad5a696c651..0873a3227be 100644 --- a/src/Features/Core/Portable/FeaturesResources.resx +++ b/src/Features/Core/Portable/FeaturesResources.resx @@ -574,6 +574,9 @@ Adding a new file will prevent the debug session from continuing. + + Attribute '{0}' is missing. Updating an async method or an iterator will prevent the debug session from continuing. + Unexpected interface member kind: {0} diff --git a/src/Test/Utilities/Shared/Mocks/TestMessageProvider.cs b/src/Test/Utilities/Shared/Mocks/TestMessageProvider.cs index 3c7c9da4234..548241f5514 100644 --- a/src/Test/Utilities/Shared/Mocks/TestMessageProvider.cs +++ b/src/Test/Utilities/Shared/Mocks/TestMessageProvider.cs @@ -386,5 +386,13 @@ public override int ERR_ModuleEmitFailure throw new NotImplementedException(); } } + + public override int ERR_EncUpdateFailedMissingAttribute + { + get + { + throw new NotImplementedException(); + } + } } } -- GitLab