question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Result of chr() cannot be used as initial value of a Const in .Net Core 3 Preview 1

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:16 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
nguerreracommented, Jul 11, 2019

This works

  <Target Name="SetVBRuntimePath" AfterTargets="ResolveAssemblyReferences">
    <PropertyGroup>
      <VBRuntime Condition="'%(ReferencePath.FileName)' == 'Microsoft.VisualBasic'">%(ReferencePath.Identity)</VBRuntime>
    </PropertyGroup>
  </Target>

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.

1reaction
333fredcommented, Jul 10, 2019

@DualBrain as a workaround, you can set the VBRuntime property to default in your vbproj file and the embedded VB runtime will not be used, allowing the referenced MS.VB.dll to be used instead.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is Chr(3) a constant expression but not Chr(172)?
If I write the following code, ReSharper will suggest I convert the first variable, chr3 to a constant, but not the second variable,...
Read more >
ASP.NET Core breaking changes for versions 3.0 and 3.1
Lists the breaking changes in ASP.NET Core 3.0 and 3.1.
Read more >
SyntaxError: missing = in const declaration - JavaScript | MDN
An initializer for a constant is required; that is, you must specify its value in the same statement in which it's declared (which...
Read more >
View | Android Developers
Quickly bring your app to life with less code, using a modern declarative approach to UI, and the simplicity of Kotlin. ... Start...
Read more >
Backward Incompatible Changes - Manual
Any array that has a number n as its first numeric key will use n+1 for its next implicit key, even if n...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found