I'm playing with a new record
feature in a console app. I'm using my VS Community 16.8.0 + R# 2020.2.4 trial.
using System;
namespace ConsoleApp2
{
class Program
{
static void Main(string[] args)
{
var test = new Person("firstname", "lastname");
Console.WriteLine($"test.FirstName: {test.FirstName} test.LastName: {test.LastName}");
}
}
public record Person(string FirstName, string LastName);
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
</Project>
The code could be compiled and it runs.
The thing is that IntelliSense does not recognise the record itself. VS underlines the record definition and does not recognise its use despite the fact that the program itself can be compiled.
What am I doing wrong?
VS somehow recognise a typo in record definition/use.
ReSharper 2020.2.4 does not support the new C# 9 features. Try the latest version (2020.3). Any further issues you have with ReSharper should best be taken up with JetBrains directly.
I have the same "problem", I should say?
ReSharper still does not get it. Records are still broken as hell for ReSharper. As long as this goes, I cannot use ReSharper in classes where records are defined or used. Too many false errors. Switching ReSharper on and off depending on the file is ridiculously annoying, which leads to mostly ReSharper deactivated. Damn. Why the heck. I also completely removed everything ReSharper related and did a clean install again. Same result with the newest version. C# (preview) can be used since months and they still did not get it managed. Wow.
@KUTlime go to "extensions" menu and select ReSharper, then to "options...". Second way of doing this is right click the black circle at the bottom right corner and click "Customize...", there you go.
Edit: Upgrading to 2020.3 EAP7 (Early Access Preview) solved the issue for me (and the preview is slower than before).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With