diff --git a/src/Compilers/CSharp/Portable/CSharpResources.Designer.cs b/src/Compilers/CSharp/Portable/CSharpResources.Designer.cs index 155950099ab752a67f0b60f38ed65a863d921674..3e022eb562675bbf1cbeccaec3c0b635df118f88 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 f053ebac9b718267ffeac763fa85744246306c02..32f2d691b09ab0629ef1b88f583dc503f39f2ed0 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 b0d2a1c103ba346d6263c39ef3d9051f05278e1f..9c303ef8934a038eb1d318bffe7d6d6806aefca9 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 68f9753fea4295dc49f73562057dfb2358efe697..bfd94287cce2f342c28a559bc37fcf1de93a4c17 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 206c4255744ff574fed0a01ff36f10e7e8cf96ed..4ae07c8d49447e1bd6316afc6115d1f7d5e46ea1 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 57b84c16767e36c74ef8282a50373373c3b4b109..60f4130d5f800df097664361bd736706bc7e6919 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 27792ee2c912fb88aa52a0f5e8f37344d4e0fc73..79b3ad36c5e795a294c1c575ea9a79e2a6576e81 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 10c2ef376aae2eca00b41f96607e69b0c07d0b1f..8f1fde86ab54d9dc27247560e4e489918cd84c3b 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 3754056736e2cb0750f6a926ed87fedbde6eaa41..1db72196394a8b9834e003ff37c917195008295f 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 e8092585d762da24c6b658325dc550331ee24ef5..035a9e55de583c00b9e54faa5f42555666e47feb 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 18cf8b2c50140d1c6f7cbc4b373a19fd51f904c7..f513f4fe6bc02b165d026ce889d1ef4fb471607e 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 8e2502adf5288317f1eba8bd5a3db7bff24bdc1f..7f8f962fa7eea5385a4ba39c252e5ccbea1c4f1a 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 37a4c052a7ce753018a6407b9968cf23533f637a..acc32315c5896fd9d92f2591ed351d6cf87301d1 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 737a3aef41a8308a2e177979f8193bf0e2fe6a53..58d43e89745b689c1a88d2a9b5997a8a6c572b13 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 89a95f260994c45dd2671d78745912c868d496b7..4367c4ffbec8e0835554b28665986c79b763e566 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 c28b867952157ead4b5aeacb7af7e8324d3eb1ad..6b902099b55f82b7b49596c553939f80aa08c2b1 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 d029e112221ce4eb5303116ee92f5ef2e0ba74a9..a78b63540b79a037cf81abfc959a8d1c7dd081ed 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 acb7dbd0d76cd25baf55a071bff76eaa466c8b53..786280bd43478b3fdec605ee68486b48c3c61a34 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 14bf73ddd419e5ecd13ded5250661563f62f3933..5f36fccee10183c3f9934bfdbe9808c65fe80478 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 4b02fecaf9871fb011a2fe003fb1027a01f574ca..9d08ec45f46a62b6016a8853d900a163402519e1 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 636a5d8d44e7e46490d77e4a04e5b0bf9a2f3f50..d25904d9c2b75b5f4d0620fad0af3aa479970d0d 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 d2d133a80f7b088f5f36dd3f9f5b611d53d93a85..fb4f07271dda421b63565de0fd1e6ab0a7b7f2e8 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 ad5a696c651373752a75456ff4885dd286e3d805..0873a3227be23c23f81e04a0c5124f0e18e1f98c 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 3c7c9da4234702e9a946a9d740e34177a3fdbea9..548241f5514e798fe820a5e608d5db8b16091186 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(); + } + } } }