Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify error for AssemblyVersion with wildcard when deterministic VB #74351

Merged
merged 3 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Compilers/VisualBasic/Portable/Errors/ErrorFacts.vb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
ERRID.ERR_MissingRuntimeHelper,
ERRID.ERR_CannotGotoNonScopeBlocksWithClosure,
ERRID.ERR_SymbolDefinedInAssembly
' Update src\EditorFeatures\VisualBasic\LanguageServer\VisualBasicLspBuildOnlyDiagnostics.vb
' Update src\Features\VisualBasic\Portable\Diagnostics\LanguageServer\VisualBasicLspBuildOnlyDiagnostics.vb
' whenever new values are added here.
Return True
Case ERRID.Void,
Expand Down Expand Up @@ -1215,6 +1215,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
ERRID.ERR_FailureSigningAssembly,
ERRID.ERR_SignButNoPrivateKey,
ERRID.ERR_InvalidVersionFormat,
ERRID.ERR_InvalidVersionFormatDeterministic,
ERRID.ERR_ExpectedSingleScript,
ERRID.ERR_ReferenceDirectiveOnlyAllowedInScripts,
ERRID.ERR_NamespaceNotAllowedInScript,
Expand Down
2 changes: 2 additions & 0 deletions src/Compilers/VisualBasic/Portable/Errors/Errors.vb
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
ERR_MutuallyExclusiveOptions = 2046
ERR_BadSwitchValue = 2047

ERR_InvalidVersionFormatDeterministic = 8357
A9G-Data-Droid marked this conversation as resolved.
Show resolved Hide resolved

'// The naming convention is that if your error requires arguments, to append
'// the number of args taken, e.g. AmbiguousName2
'//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1042,8 +1042,14 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols
Dim verString = DirectCast(attrData.CommonConstructorArguments(0).ValueInternal, String)
Dim version As Version = Nothing
If Not VersionHelper.TryParseAssemblyVersion(verString, allowWildcard:=Not _compilation.IsEmitDeterministic, version:=version) Then
diagnostics.Add(ERRID.ERR_InvalidVersionFormat, GetAssemblyAttributeFirstArgumentLocation(arguments.AttributeSyntaxOpt))
Dim attributeArgumentSyntaxLocation As Location = GetAssemblyAttributeFirstArgumentLocation(arguments.AttributeSyntaxOpt)
If _compilation.IsEmitDeterministic AndAlso verString?.Contains("*"c) = True Then
diagnostics.Add(ERRID.ERR_InvalidVersionFormatDeterministic, attributeArgumentSyntaxLocation)
Else
diagnostics.Add(ERRID.ERR_InvalidVersionFormat, attributeArgumentSyntaxLocation)
End If
End If

arguments.GetOrCreateData(Of CommonAssemblyWellKnownAttributeData)().AssemblyVersionAttributeSetting = version
ElseIf attrData.IsTargetAttribute(AttributeDescription.AssemblyFileVersionAttribute) Then
Dim dummy As Version = Nothing
Expand Down
7 changes: 5 additions & 2 deletions src/Compilers/VisualBasic/Portable/VBResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -4386,7 +4386,7 @@
<value>The specified version string does not conform to the recommended format</value>
</data>
<data name="ERR_InvalidVersionFormat2" xml:space="preserve">
<value>The specified version string does not conform to the recommended format - major.minor.build.revision</value>
<value>The specified version string does not conform to the recommended format - major.minor.build.revision (without wildcards)</value>
</data>
<data name="ERR_InvalidAssemblyCultureForExe" xml:space="preserve">
<value>Executables cannot be satellite assemblies; culture should always be empty</value>
Expand Down Expand Up @@ -5704,4 +5704,7 @@
<data name="WRN_ConvertingLock_Title" xml:space="preserve">
<value>A value of type 'System.Threading.Lock' converted to a different type will use likely unintended monitor-based locking in SyncLock statement.</value>
</data>
</root>
<data name="ERR_InvalidVersionFormatDeterministic" xml:space="preserve">
<value>The specified version string contains wildcards, which are not compatible with determinism. Either remove wildcards from the version string, or disable determinism for this compilation</value>
</data>
</root>
9 changes: 7 additions & 2 deletions src/Compilers/VisualBasic/Portable/xlf/VBResources.cs.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions src/Compilers/VisualBasic/Portable/xlf/VBResources.de.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions src/Compilers/VisualBasic/Portable/xlf/VBResources.es.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions src/Compilers/VisualBasic/Portable/xlf/VBResources.fr.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions src/Compilers/VisualBasic/Portable/xlf/VBResources.it.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions src/Compilers/VisualBasic/Portable/xlf/VBResources.ja.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions src/Compilers/VisualBasic/Portable/xlf/VBResources.ko.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions src/Compilers/VisualBasic/Portable/xlf/VBResources.pl.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading