Skip to content

Conversation

@safern
Copy link
Member

@safern safern commented Feb 17, 2021

Currently if someone tries to use C# 9.0 language features genfacades doesn't parse the syntax tree correctly and could lead to problems, i.e, when adding an attribute to a local function in PriorityQueue it causes the parent of PriorityQueue.UnorderedItemsCollection to be a CompilationUnitSyntax instead of a ClassDeclarationSyntax, causing:

C:\Users\safern\.nuget\packages\microsoft.dotnet.genfacades\6.0.0-dev\build\Microsoft.DotNet.GenPartialFacadeSource.targets(30,5): error : Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.CompilationUnitSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.BaseTypeDeclarationSyntax'. [C:\repos\runtime\src\libraries\System.Collections\src\System.Collections.csproj]

I tested this on dotnet/runtime and apparently now MSBuild loads tasks in it's own AssemblyLoadContext so now we don't have the restriction of matching the roslyn version that MSBuild depends on. This was fixed on: dotnet/msbuild#4916

cc: @ericstj @stephentoub @Anipik

@safern safern merged commit 1ca4a46 into dotnet:master Feb 19, 2021
@safern safern deleted the UpdateCodeAnalysis branch February 19, 2021 23:51
@stephentoub
Copy link
Member

Thanks, @safern.

akoeplinger pushed a commit to akoeplinger/arcade that referenced this pull request Apr 12, 2021
…otnet#6971)

* Update codeanalysis for genfacades to support new language features

* Fix source build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants