Skip to content

Intellisense behaves differently based if the class or record has required properties #81547

@vsfeedback

Description

@vsfeedback

This issue has been moved from a ticket on Developer Community.


[severity:It's more difficult to complete my work]
Since the new required properties, when creating an instance of a class or a record, the Intellisense behave differently.
The fact that it picks required properties first is fantastic, however, it messes up the flow when trying to create objects.

Basically, if I new up a record without any required properties, I can press ENTER and it's working great.
But when there are required properties, it selects the first required property, so pressing ENTER will write that property rather than adding an ENTER.

The problem is that as you new up the instance, you don't know in advance if you will have required properties in the object or not. Which makes the Intellisense behave differently based on the class/record.

It would be preferrable if the Intellisense behaved the same in both cases.
This is a productivity issue.

public class Test
{
    public record ARecordWithRequired
    {
        public required Guid RequiredProperty { get; init; }
    }

public record ARecordWithoutRequired
    {
        public Guid NonRequiredProperty { get; init; }
    }

[Test]
    public void Test1()
    {
        // Creating a record without a required property allows me to press enter after the creation
        var x = new ARecordWithoutRequired
        {
            
}
    }

public void Test2()
    {
        // Creating a record with a required property, I MUST press Escape after the creation.
        // The problem with this, is that when making a new instance, I don't know in advance if there
        // will be any required properties in my object, so the flow is different only based on the data
        // inside the record.
        // In this example, I typed slowly, but when typing fast, I always mess this up.
        var x = new ARecordWithRequired { RequiredProperty}
    }
}

Original Comments

Jean-Sébastien Goupil on 8/29/2025, 08:58 PM:

It also happens if you do

var x = new List<ARecordWithRequired> { // HERE you get ARecordWithRequired appended which doesn't make sense

This is all the time regardless if something is required or not in the class.
But does NOT happen with primitive.

Jean-Sébastien Goupil on 8/29/2025, 09:37 PM:

Furthermore, this problem is not happening if you are nested within an object already.

var x = new List<ARecordWithRequired>
{
    new ARecordWithRequired { // No intellisense kicks in here, so once again, pressing Enter differs
}

Feedback Bot on 9/1/2025, 07:39 AM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

Mei Wen Chin (Centific Technologies Inc) [MSFT] on 9/19/2025, 03:43 AM:

Thanks for your sharing the detail steps.
I can reproduce this issue through your shared steps on VS2022 community (17.14.15), and this issue has been escalated for further investigation, if there is any process, I will inform you immediately.

REPRO.gif

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions