mhutch / MonoDevelop.MSBuildEditor

Improved MSBuild editing support
Other
228 stars 26 forks source link

`Using` Include validation is incorrect for types that have CLR generics #253

Closed baronfel closed 1 month ago

baronfel commented 1 month ago

Given the following snippet from a C# project file:

 <!-- Global usings -->
  <!-- See: https://learn.microsoft.com/dotnet/core/project-sdk/msbuild-props#using -->
  <ItemGroup>
    <!-- Aliases -->
    <!-- Note: '%3C' is for '<' and '%3E' is for '>' -->
    <Using Include="System.Collections.Generic.Dictionary%3CMicrosoft.NET.Sdk.WorkloadManifestReader.WorkloadId, Microsoft.NET.Sdk.WorkloadManifestReader.WorkloadDefinition%3E" Alias="WorkloadCollection" />
  </ItemGroup>

image

The extension errors on the Include because of the escaped < and > characters. It might be useful to

mhutch commented 1 month ago

There is are "clr-type", "clr-type-name" and "clr-namespace" types, and it looks like this uses "clr-namespace", whereas it should be "clr-type" - or maybe "csharp-type", as the syntax for generic is not universal.

However, handling of both XML and MSBuild escaping is a bit iffy in general, and I think that's the main problem here.