dotnet / docfx

Static site generator for .NET API documentation.
https://dotnet.github.io/docfx/
MIT License
4.06k stars 862 forks source link

Invalid cref value "!:XElement" #5112

Closed Weasy666 closed 1 year ago

Weasy666 commented 5 years ago

Operation System: (Windows or Linux or MacOS) Azure Pipelines...i guess Windows.

DocFX Version Used: Don't know what version is used by MixedReality Toolkit.

Steps to Reproduce:

  1. Create some triple slash comment with a cref to an XElement.
  2. Build docs with this config

Expected Behavior: XElement will get referenced.

Actual Behavior: Invalid cref value "!:XElement" found in triple-slash-comments for AddCapability, ignored.

For more details you can take a look here https://github.com/microsoft/MixedRealityToolkit-Unity/pull/5891#discussion_r324784448

superyyrrzz commented 5 years ago

Can Visual Studio find this type, or also complain about a warning?

Weasy666 commented 5 years ago

There is no problem in Visual Studio. The type is a regular Microsoft type XElement. If you take a look at the MixedReality Toolkit link you can see that the error does not only occur for XElement but also for XAttribute and XName. So i guess there is maybe a general problem with the System.Xml.Linq Namespace.

superyyrrzz commented 5 years ago

I had a peek at the repo, but did not find any existing .csproj/.sln to help me see its behavior in Visual Studio. BTW, have you tried the full name System.Xml.Linq.XElement?

Weasy666 commented 5 years ago

No, i haven't tried that. I'm a first time contributer to that project so i'm not in a position to try that. But maybe @wiwei can try?

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in a week if no further activity occurs.

tparviainen commented 4 years ago

I'm seeing similar issue with my .NET Standard assembly, however I also found the workaround for this issue. Here are the repro steps:

git clone https://github.com/tparviainen/clashofclans.git clash1
cd clash1/docfx
docfx

That generates several warning messages about Invalid cref value "!:System.ArgumentException" found in triple-slash-comments.

If you instead do next steps you do not see those warning messages:

git clone https://github.com/tparviainen/clashofclans.git clash2
cd clash2/docfx
dotnet build ../src/ClashOfClans/ClashOfClans.csproj
docfx

So it seems that if the component is first compiled and after that the documentation is generated by DocFX the issue is not present.

koffie commented 4 years ago

I verified @tparviainen his solution and worked for my project. I think this van be closed.

martinoss commented 4 years ago

In my case, a wrong target framework configured in docfx.json. I copied it from a 4.7.2 project, but the new one had netstandard2.0. But I additionally got the warning The "ResolvePackageAssets" task failed unexpectedly. NuGet.Frameworks.FrameworkException: Invalid framework identifier ''.

arnonax-tr commented 2 years ago

For me the solution was to change the name in the cref to a full name. E. g, instead of <exception cref="ArgumentNullException">, I changed to <exception cref="System.ArgumentNullException">.