Describe the bug
Running docfx metadata on a .NET 8 WPF DLL generates a bunch of wrong warnings.
Since we use --warningsAsErrors, this is a blocker for us. :(
The transitive dependency DirectWriteForwarder.dll references assemblies from .NET 8 and .NET Framework. UniversalAssemblyResolver cannot handle this.
To Reproduce
- Create a simple WPF assembly with
<TargetFramework>net8.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
- Configure
docfx.json to process assemblies (the problem does not occur when processing project files)
{
"metadata": [
{
"src": [
{
"files": ["artifacts/assemblies/*.dll"],
"src": "./"
}
],
"dest": "api"
}
]
}
- Execute
dotnet docfx metadata .\docfx.json
This results in the following warnings:
dotnet docfx metadata .\docfx.json
Using .NET Core SDK 8.0.100
Loading assembly C:/Users/hahn/Projects/DocFxTest/artifacts/assemblies/DocFxWarningTest.dll
warning: Unable to resolve assembly reference System.Data.SqlClient, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
warning: Unable to resolve assembly reference System.Data.Odbc, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
warning: Unable to resolve assembly reference System.Data.OleDb, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
warning: Unable to resolve assembly reference System.IO.Ports, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
warning: Unable to resolve assembly reference System.Runtime.Serialization.Schema, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
warning: Unable to resolve assembly reference System.ServiceModel.Syndication, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
warning: Unable to resolve assembly reference System.ServiceProcess.ServiceController, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Processing DocFxWarningTest
Creating output...
Build succeeded with warning.
7 warning(s)
0 error(s)
Expected behavior
There should be no warnings.
Context (please complete the following information):
- OS: Windows 11
- Docfx version: 2.74.0+0a19218b660d592013a1d75479f013d69a6c5d71
Additional context
I ran docfx in the debugger and was able to see where the dependency is coming from:
PresentationCore -> DirectWriteForwarder -> System.Data -> System.Data.SqlClient
DirectWriteForwarder is referencing System.Data from .NET Framework (C:\Windows\Microsoft.NET\Framework64\v4.0.30319\System.Data.dll).
UniversalAssemblyResolver.FindAssemblyFile in CompilationHelper is resolving C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.0\System.Data.dll instead, which is a reference assembly that only contains forwarded types.
Since these references with 0.0.0.0 version cannot be resolved, the warnings are generated.
Describe the bug
Running
docfx metadataon a .NET 8 WPF DLL generates a bunch of wrong warnings.Since we use
--warningsAsErrors, this is a blocker for us. :(The transitive dependency
DirectWriteForwarder.dllreferences assemblies from .NET 8 and .NET Framework.UniversalAssemblyResolvercannot handle this.To Reproduce
docfx.jsonto process assemblies (the problem does not occur when processing project files){ "metadata": [ { "src": [ { "files": ["artifacts/assemblies/*.dll"], "src": "./" } ], "dest": "api" } ] }dotnet docfx metadata .\docfx.jsonThis results in the following warnings:
Expected behavior
There should be no warnings.
Context (please complete the following information):
Additional context
I ran docfx in the debugger and was able to see where the dependency is coming from:
PresentationCore -> DirectWriteForwarder -> System.Data -> System.Data.SqlClientDirectWriteForwarderis referencingSystem.Datafrom .NET Framework (C:\Windows\Microsoft.NET\Framework64\v4.0.30319\System.Data.dll).UniversalAssemblyResolver.FindAssemblyFileinCompilationHelperis resolvingC:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.0\System.Data.dllinstead, which is a reference assembly that only contains forwarded types.Since these references with 0.0.0.0 version cannot be resolved, the warnings are generated.