dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
18.92k stars 4.02k forks source link

CodeNamespace.Members does not include records #62523

Open PhilPJL opened 2 years ago

PhilPJL commented 2 years ago

Not sure where or how to report this but was redirected here from the developer community forum. My original post is https://developercommunity.visualstudio.com/t/CodeNamespaceMembers-does-not-include-r/10035834

The issue boils down to EnvDTE does not currently support the record keyword.

CyrusNajmabadi commented 2 years ago

Yes, this is true. Codemodel is an extremely problematic legacy api. It's slow, mutable, and only usable from the ui thread. It is also not receiving updates. It has been superseded by the Roslyn syntactic and semantic apis. Those apis are much faster, immutable, and can be used safely off of the ui thread.

Thanks!

PhilPJL commented 2 years ago

It is also not receiving updates.

Point me at the MS statement that says that. As I understand it Entity Framework Core 7 is planning to use T4 templates so I'm assuming they're not deprecated.

CyrusNajmabadi commented 2 years ago

Point me at the MS statement that says that.

^ https://github.com/dotnet/roslyn/issues/62523#issuecomment-1179559126

We haven't updated code model, except for trivial issues, in more than a decade. It and codedom have been replaced with the Roslyn apis for getting full syntactic and semantic information about c# code. It's one of the reasons we made Roslyn in the first place :-)

Note: I believe the last time we even updated codemodel and codedom was around c#2 (maybe 3), or more than 15 years ago. They've been effectively in stasis since that point.

The codemodel design was fundamentally too limiting and unmaintainable. It had low fidelity, and a bunch of other issues due to it's COM roots. Roslyn is the modern replacement for it and has 100% fidelity with the language (and all it's updates) since the start, without any of those limitations. Every new release of the language gets full Roslyn support. That's because the Roslyn api is the api the actual compiler is using. It's not an overlay. So it always has to be complete so that the actual compiler can do it's job.