提交 a1e88fd0 编写于 作者: C Charles Stoner

Ensure string resources are included for all diagnostic ids

上级 43f3499a
......@@ -3706,6 +3706,15 @@ internal class CSharpResources {
}
}
/// <summary>
/// Looks up a localized string similar to Cannot update &apos;{0}&apos;; attribute &apos;{1}&apos; is missing..
/// </summary>
internal static string ERR_EncUpdateFailedMissingAttribute {
get {
return ResourceManager.GetString("ERR_EncUpdateFailedMissingAttribute", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to #endif directive expected.
/// </summary>
......
......@@ -1646,6 +1646,9 @@ If such a class is used as a base class and if the deriving class defines a dest
<data name="ERR_DllImportOnInvalidMethod" xml:space="preserve">
<value>The DllImport attribute must be specified on a method marked 'static' and 'extern'</value>
</data>
<data name="ERR_EncUpdateFailedMissingAttribute" xml:space="preserve">
<value>Cannot update '{0}'; attribute '{1}' is missing.</value>
</data>
<data name="ERR_DllImportOnGenericMethod" xml:space="preserve">
<value>The DllImport attribute cannot be applied to a method that is generic or contained in a generic type.</value>
</data>
......
......@@ -1006,17 +1006,17 @@ internal enum ErrorCode
ERR_BadDynamicQuery = 1979,
ERR_DynamicAttributeMissing = 1980,
WRN_IsDynamicIsConfusing = 1981,
ERR_DynamicNotAllowedInAttribute = 1982, // Replaced by ERR_BadAttributeParamType in Roslyn.
//ERR_DynamicNotAllowedInAttribute = 1982, // Replaced by ERR_BadAttributeParamType in Roslyn.
ERR_BadAsyncReturn = 1983,
ERR_BadAwaitInFinally = 1984,
ERR_BadAwaitInCatch = 1985,
ERR_BadAwaitArg = 1986,
ERR_BadAsyncArgType = 1988,
ERR_BadAsyncExpressionTree = 1989,
ERR_WindowsRuntimeTypesMissing = 1990,
//ERR_WindowsRuntimeTypesMissing = 1990, // unused in Roslyn
ERR_MixingWinRTEventWithRegular = 1991,
ERR_BadAwaitWithoutAsync = 1992,
ERR_MissingAsyncTypes = 1993,
//ERR_MissingAsyncTypes = 1993, // unused in Roslyn
ERR_BadAsyncLacksBody = 1994,
ERR_BadAwaitInQuery = 1995,
ERR_BadAwaitInLock = 1996,
......
......@@ -5,15 +5,38 @@
using System.Globalization;
using System.Linq;
using Microsoft.CodeAnalysis.CSharp.Test.Utilities;
using Microsoft.CodeAnalysis.Emit;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Test.Utilities;
using Xunit;
using Microsoft.CodeAnalysis.Emit;
namespace Microsoft.CodeAnalysis.CSharp.UnitTests
{
public partial class DiagnosticTest : CSharpTestBase
{
/// <summary>
/// Ensure string resources are included.
/// </summary>
[Fact]
public void Resources()
{
var excludedErrorCodes = new[]
{
ErrorCode.Void,
ErrorCode.Unknown,
ErrorCode.WRN_ALinkWarn, // Not reported, but retained to allow configuring class of related warnings. See CSharpDiagnosticFilter.Filter.
};
foreach (ErrorCode code in Enum.GetValues(typeof(ErrorCode)))
{
if (Array.IndexOf(excludedErrorCodes, code) >= 0)
{
continue;
}
var message = ErrorFacts.GetMessage(code, CultureInfo.InvariantCulture);
Assert.False(string.IsNullOrEmpty(message));
}
}
[Fact]
public void TestDiagnostic()
{
......
......@@ -1451,7 +1451,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
ERR_MultilineLambdasCannotContainOnError = 36668
'ERR_BranchOutOfMultilineLambda = 36669 obsolete - was not even reported in Dev10 any more.
ERR_LambdaBindingMismatch2 = 36670
ERR_MultilineLambdaShadowLocal1 = 36671
'ERR_MultilineLambdaShadowLocal1 = 36671 'unused in Roslyn
ERR_StaticInLambda = 36672
ERR_MultilineLambdaMissingSub = 36673
ERR_MultilineLambdaMissingFunction = 36674
......@@ -1468,7 +1468,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
ERR_OverloadCandidate1 = 36712
ERR_AutoPropertyInitializedInStructure = 36713
ERR_InitializedExpandedProperty = 36714
ERR_NewExpandedProperty = 36715
'ERR_NewExpandedProperty = 36715 'unused in Roslyn
ERR_LanguageVersion = 36716
ERR_ArrayInitNoType = 36717
......@@ -1545,7 +1545,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
ERR_CannotUseGenericBaseTypeAcrossAssemblyBoundaries = 36925
ERR_BadAsyncByRefParam = 36926
ERR_BadIteratorByRefParam = 36927
ERR_BadAsyncExpressionLambda = 36928
'ERR_BadAsyncExpressionLambda = 36928 'unused in Roslyn
ERR_BadAsyncInQuery = 36929
ERR_BadGetAwaiterMethod1 = 36930
'ERR_ExpressionTreeContainsAwait = 36931
......@@ -1561,7 +1561,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
'// unused 36941
ERR_BadReturnValueInIterator = 36942
ERR_BadAwaitInTryHandler = 36943
ERR_BadAwaitObject = 36944
'ERR_BadAwaitObject = 36944 'unused in Roslyn
ERR_BadAsyncReturn = 36945
ERR_BadResumableAccessReturnVariable = 36946
ERR_BadIteratorExpressionLambda = 36947
......@@ -1570,7 +1570,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
ERR_ConstructorAsync = 36950
ERR_InvalidLambdaModifier = 36951
ERR_ReturnFromNonGenericTaskAsync = 36952
ERR_BadAutoPropertyFlags1 = 36953
'ERR_BadAutoPropertyFlags1 = 36953 'unused in Roslyn
ERR_BadOverloadCandidates2 = 36954
ERR_BadStaticInitializerInResumable = 36955
......@@ -1696,9 +1696,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
ERR_RefReturningCallInExpressionTree = 37263
ERR_LastPlusOne
'// WARNINGS BEGIN HERE
WRN_UseOfObsoleteSymbol2 = 40000
WRN_MustOverloadBase4 = 40003
......
......@@ -954,6 +954,15 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Algorithm &apos;{0}&apos; is not supported.
'''</summary>
Friend ReadOnly Property ERR_BadChecksumAlgorithm() As String
Get
Return ResourceManager.GetString("ERR_BadChecksumAlgorithm", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Classes cannot be declared &apos;{0}&apos;..
'''</summary>
......@@ -9829,6 +9838,15 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End Get
End Property
'''<summary>
''' Looks up a localized string similar to /sourcelink switch is only supported when emitting Portable PDB (/debug:portable or /debug:embedded must be specified)..
'''</summary>
Friend ReadOnly Property ERR_SourceLinkRequiresPortablePdb() As String
Get
Return ResourceManager.GetString("ERR_SourceLinkRequiresPortablePdb", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Specifiers and attributes are not valid on this statement..
'''</summary>
......
......@@ -198,6 +198,9 @@
<data name="ERR_MissingGuidForOption" xml:space="preserve">
<value>Command-line syntax error: Missing Guid for option '{1}'</value>
</data>
<data name="ERR_BadChecksumAlgorithm" xml:space="preserve">
<value>Algorithm '{0}' is not supported</value>
</data>
<data name="WRN_BadSwitch" xml:space="preserve">
<value>unrecognized option '{0}'; ignored</value>
</data>
......@@ -5369,6 +5372,9 @@
<data name="ERR_OptionMustBeAbsolutePath" xml:space="preserve">
<value>Option '{0}' must be an absolute path.</value>
</data>
<data name="ERR_SourceLinkRequiresPortablePdb" xml:space="preserve">
<value>/sourcelink switch is only supported when emitting Portable PDB (/debug:portable or /debug:embedded must be specified).</value>
</data>
<data name="ERR_TupleDuplicateMemberName" xml:space="preserve">
<value>Tuple member names must be unique.</value>
</data>
......
......@@ -113,6 +113,7 @@
<Compile Include="Diagnostics\CompilationEventTests.vb" />
<Compile Include="Diagnostics\DiagnosticAnalyzerTests.AllInOne.vb" />
<Compile Include="Diagnostics\DiagnosticAnalyzerTests.vb" />
<Compile Include="Diagnostics\DiagnosticTests.vb" />
<Compile Include="Diagnostics\GetDiagnosticsTests.vb" />
<Compile Include="Diagnostics\IOperationTests.vb" />
<Compile Include="Diagnostics\OperationAnalyzerTests.vb" />
......@@ -231,4 +232,4 @@
<Import Project="..\..\..\..\..\build\Targets\VSL.Imports.targets" />
<Import Project="..\..\..\..\..\build\Targets\Roslyn.Toolsets.Xunit.targets" />
</ImportGroup>
</Project>
</Project>
\ No newline at end of file
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Globalization
Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests
Public Class DiagnosticTests
Inherits BasicTestBase
''' <summary>
''' Ensure string resources are included.
''' </summary>
<Fact()>
Public Sub Resources()
Dim excludedIds = {
ERRID.Void,
ERRID.Unknown,
ERRID.ERR_None,
ERRID.ERR_CannotUseGenericBaseTypeAcrossAssemblyBoundaries ' Not reported. See ImportsBinder.ShouldReportUseSiteErrorForAlias.
}
For Each id As ERRID In [Enum].GetValues(GetType(ERRID))
If id >= ERRID.ERRWRN_Last Then
Continue For
End If
If Array.IndexOf(excludedIds, id) >= 0 Then
Continue For
End If
Dim message = ErrorFactory.IdToString(id, CultureInfo.InvariantCulture)
Assert.False(String.IsNullOrEmpty(message))
Next
End Sub
End Class
End Namespace
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册