dotnet/roslyn

Move Type to .cs file fails

Open

#58,014 opened on Nov 29, 2021

View on GitHub
 (1 comment) (0 reactions) (1 assignee)C# (4,257 forks)batch import
Area-IDEBugDeveloper Communityhelp wanted

Repository metrics

Stars
 (20,414 stars)
PR merge metrics
 (Avg merge 6d 17h) (256 merged PRs in 30d)

Description

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


Intellisense fails to remove the class created when I've selected the "Move type to .cs" option. It does create the new file, but does not remove the class from where I called the intellisense method.

    public class ProductGroup : IReadModel
    {
        public string? ProductGroupId { get; set; }

public string? Name { get; set; }
    }

public class ProductGroupValidator : IValidator<ProductGroup>
    {
        public bool IsValid(ProductGroup productGroup)
        {
            if (productGroup == null)
                throw new ValidationException($"ProductGroup received was null");

if (string. IsNullOrEmpty(productGroup.Name))
                throw new ValidationException($"ProductGroup Name is blank");

if (string. IsNullOrEmpty(productGroup.ProductGroupId))
                throw new ValidationException($"ProductGroup Id is blank");

return true;
        }
    }

In the file ProductGroup.cs, hover over the class ProductGroupValidator and select "Move type to ProductGroupValidator.cs" to replicate.


Original Comments

Feedback Bot on 11/16/2021, 02:07 AM:

Feedback Bot on 11/16/2021, 09:47 AM:

Andrew Hall 🤘 [MSFT] on 11/16/2021, 09:06 PM:

Pedro Dias on 11/23/2021, 07:31 PM:

Feedback Bot on 11/23/2021, 05:51 PM:

We will close this report in 14 days because we don’t have enough information to investigate further. To keep the problem open, please provide the requested details.


Original Solutions

(no solutions)

Contributor guide