sdk: Result of chr() cannot be used as initial value of a Const in .Net Core 3 Preview 1
Version: 3.0.100-preview-009812 Commit: e3abf6e935
Runtime Environment: OS Name: Windows OS Version: 10.0.17763 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\3.0.100-preview-009812\
Host (useful for support): Version: 3.0.0-preview-27122-01 Commit: 00c5c8bc40
Have you experienced this same bug with .NET Framework?: No
In the .Net Framework using VB.Net you can compile this Line:
Private Const TabChar As Char = Chr(9)
In .Net Core 3 Preview 1 it failes with: error BC30059: Constant expression is required.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 16 (12 by maintainers)
Commits related to this issue
- Update dependencies from https://github.com/aspnet/AspNetCore-Tooling build 20190910.3 (#2793) - Microsoft.NET.Sdk.Razor - 3.1.0-alpha1.19460.3 — committed to dotnet/sdk by dotnet-maestro[bot] 5 years ago
- Merge remote-tracking branch 'upstream/release/3.1.1xx' into merges/release/3.1.1xx-to-master * upstream/release/3.1.1xx: (603 commits) [release/3.0.1xx] Update dependencies from microsoft/vstest (... — committed to dotnet/sdk by livarcocc 5 years ago
- Copied analyzers from dotnet/runtime (#2793) * Copied analyzers from dotnet/runtime * Remove rules from unused analyzer * Disable conflicting rules * Temporarily disable violated rules * ... — committed to GangWang01/sdk by bekir-ozturk 3 years ago
- Copied analyzers from dotnet/runtime (#2793) * Copied analyzers from dotnet/runtime * Remove rules from unused analyzer * Disable conflicting rules * Temporarily disable violated rules * ... — committed to GangWang01/sdk by bekir-ozturk 3 years ago
- Copied analyzers from dotnet/runtime (#2793) * Copied analyzers from dotnet/runtime * Remove rules from unused analyzer * Disable conflicting rules * Temporarily disable violated rules * ... — committed to GangWang01/sdk by bekir-ozturk 3 years ago
- Copied analyzers from dotnet/runtime (#2793) * Copied analyzers from dotnet/runtime * Remove rules from unused analyzer * Disable conflicting rules * Temporarily disable violated rules * ... — committed to GangWang01/sdk by bekir-ozturk 3 years ago
This works
It is basically doing what @AlekseyTs said: if there’s an microsoft.visualbasic.dll in the references, use that. I will base the real fix around this.
@DualBrain as a workaround, you can set the
VBRuntimeproperty todefaultin your vbproj file and the embedded VB runtime will not be used, allowing the referenced MS.VB.dll to be used instead.Hi, Any Update on this? I just tried to convert a VB.Net Project from the Old Project Format into the SDK Project Format and noticed that I ran into the Very same problem.