dotnet / dotnet/docfx

docfx v2 creates wrong metadata for .NET472 project when Visual Studio 2022 gets installed

Open
#7,626 1 comment 0 reactions 0 assignees View on GitHub
dotnet
Dominant language
C#
Stars
4.4k
Forks
890
Avg merge
2h 9m
Merged PRs (30d)
11

Description

**Operating System**: `Windows`
**DocFX Version Used**: 2.58.4
**Steps to Reproduce**:

1. Install VS2019
2. md c:\temp\docfx && c:\temp\docfx
3. docfx init --quiet
4. cd docfx_project\src
5. dotnet new classlib -f netstandard2.0
6. change project type to "net472"
7. Create file `IInterface.cs` with the content below.
8. cd ..
9. docfx metadata --force
10. check docfx_project\api\src.IInterface.yml
11. Install VS2022 (preview)
12. docfx metadata --force
13. check docfx_project\api\src.IInterface.yml

```cs
using System;
using System.Threading;
using System.Threading.Tasks;
namespace src
{
public interface IInterface
{
Task RunAsync(CancellationToken ct);
}
}
```

**Expected Behavior**:
The metadata generated for the interface are identical.

**Actual Behavior**:
The "uid" of `RunAsync` is changed from
`src.IInterface.RunAsync(System.Threading.CancellationToken)`
to
`src.IInterface.RunAsync(CancellationToken)`

The name of system types loses the namespace qualifier which causes "invalid cross reference(s)" warnings and broken links.

1. If VS2019 and VS2022 are installed, how to force docfx to use VS2019?
2. Are changes in VS2022 required before RTM release? I think the uid should be generated always with the fully qualified name.
3. I could reproduce the issue so far only with net472. Maybe other targets are affected too.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.