-
Notifications
You must be signed in to change notification settings - Fork 866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] System.Data warnings for .NET 8 WPF assemblies #9459
Comments
I also checked ILSpy and it seems the problem is not new with .NET 8. ILSpy is using the wrong path. We were previously using .NET 6 and Docfx 2.59.4.0 without the warnings. So it seems recent changes in |
We have the same problem since we upgraded docfx to .NET 8. We generally want to build the docs warning-free to validate that we don't have any missing links or other errors in the docs, that's also why we turned on |
I also opened an issue for ILSpy. |
I have the same problem with net6 assemblies but in my case I sometimes even get the following error that prevents my build:
Since ILSpy does not seem to do anything about it I tested some stuff and noticed ILSpy is able to resolve the previously unresolvable assembly after I opended it in ILSpy before I (re)load my assembly. Maybe it is possible to work around this issue in docfx aswell if we could add the framework-dlls via references in docfx.json and load them in the ILSpy-reflection beforehand? Does docfx currently use the references configuration in assembly reflection at all? |
No, it's not. The System.Data.dll located in the .NET 6.0 SDK directory has the correct version number (which is 4.0.0.0). Why should ILSpy fall back to a possibly outdated/incompatible version from classic .NET? See also my comment in the ILSpy repository: icsharpcode/ILSpy#3128 (comment) |
It is NOT a reference assembly. It just exists for backwards compatibility (like mscorlib.dll and netstandard.dll). Reference assemblies are assemblies that contain all externally visible type definitions, but no IL (just a dummy
@Herrmel I tested this and this stuff works in ILSpy. Since we didn't even know that docfx is using our assembly resolver and we don't know what their expectations are it's hard for us to provide a solution. I would be glad to provide support, if the maintainers of this project got in touch with us and shared some more info. One thing I noticed:
These assemblies are not part of the default .NET 8.0 Windows Desktop framework. If you want to use them, you need to add references to nuget packages. For ILSpy it is impossible to detect whether a reference originated from a nuget package, because there is just a normal reference in the binary. However, there should be a I can help you debug this, if somebody provides setup and reproduction steps with docfx. Thank you very much! |
I had a quick look at the code in Also, can someone explain what the Also keep in mind that ILSpy and the decompiler engine, for which UniversalAssemblyResolver was created, are designed to work even if some references cannot be resolved. It will add extra casts in the decompiled code and may not be able to detect all patterns, but still do its best. So, if you are using UniversalAssemblyResolver, you should not expect it to deliver flawless results in all cases. Roslyn on the other hand expects you to provide all necessary information and produces an error if you fail to do so. I believe that ILSpy is not exactly the right tool for this job, but instead the dotnet/docfx people should talk to the dotnet/runtime people and ask them, to provide an assembly resolver that "does what the runtime does". |
I've confirmed reported issue can be reproduced with following steps.
|
True. This is the mess to live with and I'll exclude the warning from docfx side. Thank you @siegfriedpammer for looking into it. |
I actually had a different Problem wich is now fixed in ILSpy. In my case for whatever reason .net left behind empty Version folders. IlSpy tried to use these older and empty version folders to find the referenced assemblies and its problematic to use a compilation without the core library. |
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
docfx.json
to process assemblies (the problem does not occur when processing project files)dotnet docfx metadata .\docfx.json
This 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.SqlClient
DirectWriteForwarder
is referencingSystem.Data
from .NET Framework (C:\Windows\Microsoft.NET\Framework64\v4.0.30319\System.Data.dll
).UniversalAssemblyResolver.FindAssemblyFile
inCompilationHelper
is resolvingC:\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.
The text was updated successfully, but these errors were encountered: