Closed ltrzesniewski closed 1 year ago
I also noticed that this signature is outdated:
It's the case for a long time though: https://github.com/dotnet/roslyn/pull/33183 introduced the first change (in 2019).
Thanks so much! This is big help.
Oh, and regarding the signature of IMetadataAsSourceService.AddSourceToAsync
, you're absolutely right, they've changed it in a way that makes it impossible to create a delegate for (because of the internal type https://sourceroslyn.io/#Microsoft.CodeAnalysis.Workspaces/CleanCodeGenerationOptions.cs,6b9a1e6e70bb2183).
Ideally we'd need to rewrite this entire piece to just decompile using ILSpy and not rely on Roslyn's internal API. However it's a non-trivial amount of work and I don't know if there are a lot of users that index .dll files for Metadata-as-source, so unfortunately I'll have to table it for now.
Well, I suppose you could create the internal type using Activator.CreateInstance
then call the method through reflection (or IL emitted code if it needs to be fast), but that won't be pretty...
Another option would be to use IgnoresAccessChecksToGenerator to gain access to all of Roslyn's internal APIs through IgnoresAccessChecksToAttribute
. That's what RoslynPad does for instance.
It's a bit of a shame that Roslyn doesn't make more of its APIs public. This hides some of the value the platform can bring, and forces projects that want to leverage it to jump through hoops, just like the name of your WorkspaceHacks
class shows. I also needed to use hacks for an internal tool with a C# expression editor for instance. 😞
Thanks for the release BTW 🙂
Tell me about it! Roslyn causes me so much pain too, not just in this project!
Damn 😬
Hopefully someday the Roslyn team will consider making more of their features public. Even having some APIs which would be marked as "unstable", in the sense that they would be allowed to change between minor releases, could be helpful.
This PR updates Roslyn to v4.4.0.
I was getting the following error with the .NET 7 SDK:
It seems to work at first glance after the update, though maybe I didn't check thoroughly enough.
I kept MSBuild at the current version, as I wasn't sure if you'd rather keep it that way. I just added a
NuGetVersionMSBuild
property for consistency. Also, the MEF assembly references an older version of Roslyn, and I wasn't sure if I should update it, so I left it as-is.