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.

Custom record constructors are highlighted as struct

See original GitHub issue

Version Used: VS 16.7.2

Steps to Reproduce:

Code like below:

public sealed record Record(int A, int B, int C, int D)
{
    public Record() : this(default, default, default, default)
    {
    }
}

Expected Behavior: The constructor name Record will be highlighted in green (classes).

Actual Behavior: The constructor is highlighted in pink (structs). In my machine, classes will be highlighted in green, while the structs are pink.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:13 (12 by maintainers)

github_iconTop GitHub Comments

5reactions
CyrusNajmabadicommented, Aug 20, 2020

We probably want a new classification for this entirely. A record is a record. If people want records to have a different color, we should likely support that 😃 Note, the default here can be for it to colored like a class (same as we do for interfaces/delegates/etc.).

0reactions
CyrusNajmabadicommented, Sep 15, 2020

Oh i see. You’re asking that the decl be classified in a certain fashion, not that references be classified. That’s a very interesting case. Would you be willing to open an issue asking for this? I can take it to a design meeting to see how the team feels on this.

Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

C# — Class, Struct, Record, Record Struct | by GM Fuster
Class: a construct that enables you to create your own custom types by grouping together variables of other types, methods and events. Struct:...
Read more >
C# - Calling a struct constructor that has all defaulted ...
This is pretty evident, since C# will not let you define a parameterless constructor for a struct , though it is curious that...
Read more >
Record structs - C# 10.0 draft feature specifications
Instance field declarations for a record struct are permitted to include variable initializers. If there is no primary constructor, the instance ...
Read more >
C# 10 - `record struct` Deep Dive & Performance Implications
In this blog post I will do a deep dive into record struct being ... Constructor matching the properties; Custom overridden ToString() ...
Read more >
Should structs Have Constructors in C++
Custom initialization without a constructor ... To break this dependency we can tear out the constructor from the struct and replace it with...
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