Skip to content
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

metadata broken with mono and linux #2358

Closed
CPlusPlus17 opened this issue Jan 16, 2018 · 12 comments
Closed

metadata broken with mono and linux #2358

CPlusPlus17 opened this issue Jan 16, 2018 · 12 comments
Labels
bug A bug to fix fundamental: xplat Cross-platform support

Comments

@CPlusPlus17
Copy link

DocFX Version Used: Latest release with mono 5.4.1.6

Template used: Default

Steps to Reproduce:

  1. mono docfx.exe metadata

Expected Behavior:

It works.

Actual Behavior:

mono ../../Downloads/docfx.exe metadata                                                                                                                                                                                                       ✓  1123  23:36:43 
[18-01-16 10:36:59.052]Info:Config file docfx.json found, start generating metadata...
[18-01-16 10:37:05.369]Info:[ExtractMetadata]Loading projects...
[18-01-16 10:37:05.820]Warning:[ExtractMetadata](/home/mgysin/RiderProjects/lamada/lamada/lamada.csproj)Workspace failed with: [Failure] Msbuild failed when processing the file '/home/mgysin/RiderProjects/lamada/lamada/lamada.csproj' with message: Operation is not supported on this platform.
[18-01-16 10:37:05.873]Warning:[ExtractMetadata]Project '/home/mgysin/RiderProjects/lamada/lamada/lamada.csproj' does not contain any documents.
[18-01-16 10:37:05.891]Info:[ExtractMetadata]Cache for /home/mgysin/RiderProjects/lamada/lamada/lamada.csproj in /home/mgysin/RiderProjects/lamada/lamada/obj/xdoc/cache/final/741176259 is corrupted, rebuild...
[18-01-16 10:37:05.891]Info:[ExtractMetadata]Generating metadata for each project...
[18-01-16 10:37:05.991]Info:[ExtractMetadata]'/home/mgysin/RiderProjects/lamada/lamada/lamada.csproj' keep up-to-date since '1/16/2018 8:59:24 PM', cached intermediate result '/home/mgysin/RiderProjects/lamada/lamada/obj/xdoc/cache/obj/yigx11l9.c61' is used.
[18-01-16 10:37:06.039]Warning:[ExtractMetadata]No metadata is generated for lamada.
[18-01-16 10:37:06.054]Info:Completed in 6894.4386 milliseconds


Build succeeded with warning.
[18-01-16 10:37:06.056]Warning:[ExtractMetadata](/home/mgysin/RiderProjects/lamada/lamada/lamada.csproj)Workspace failed with: [Failure] Msbuild failed when processing the file '/home/mgysin/RiderProjects/lamada/lamada/lamada.csproj' with message: Operation is not supported on this platform.
[18-01-16 10:37:06.056]Warning:[ExtractMetadata]Project '/home/mgysin/RiderProjects/lamada/lamada/lamada.csproj' does not contain any documents.
[18-01-16 10:37:06.056]Warning:[ExtractMetadata]No metadata is generated for lamada.
	3 Warning(s)
	0 Error(s)
@trevex
Copy link

trevex commented Jan 17, 2018

I am having the same problem with a dotnet core project on linux.

docfx v2.30
mono 5.0.0 (tried 5.4.1.6 as well though same issue)
msbuild 15.3

If I generate the documentation for docfx-seed on the other hand, everything works fine.

Is this a general incompatibility with linux+netcoreapp2.0 at the moment?

@vicancy
Copy link
Contributor

vicancy commented Jan 19, 2018

Should've supported since #2268
Hi @ManuelGysin @trevex is it possible for you to provide a minimum failed project for me to repro and take a look?

@vicancy
Copy link
Contributor

vicancy commented Jan 19, 2018

Related reference dotnet/roslyn#20848 (comment)

@trevex
Copy link

trevex commented Jan 19, 2018

I uploaded the basic initial project I used to test this: https://github.com/trevex/CueX

I also installed the lastest stable mono and dotnet-sdk on OSX and get the same error:

nik@localhost ~/Development/CueX/Documentation                        [3:48:43]
> $ docfx metadata                                                 [±master ●●]
[18-01-19 02:52:36.847]Info:Config file docfx.json found, start generating metadata...
[18-01-19 02:52:37.114]Info:[ExtractMetadata]Loading projects...
[18-01-19 02:52:37.938]Warning:[ExtractMetadata](/Users/nik/Development/CueX/CueX.API/CueX.API.csproj)Workspace failed with: [Failure] Msbuild failed when processing the file '/Users/nik/Development/CueX/CueX.API/CueX.API.csproj' with message: Operation is not supported on this platform.
[18-01-19 02:52:38.048]Warning:[ExtractMetadata](/Users/nik/Development/CueX/CueX.Core/CueX.Core.csproj)Workspace failed with: [Failure] Msbuild failed when processing the file '/Users/nik/Development/CueX/CueX.Core/CueX.Core.csproj' with message: Operation is not supported on this platform.
...

Exporting MSBUILD_EXE_PATH changes the error message though to:

nik@localhost ~/Development/CueX/Documentation                        [3:56:16]
> $ export MSBUILD_EXE_PATH=/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/msbuild/15.0/bin/MSBuild.dll && docfx metadata
[18-01-19 02:56:45.728]Info:Config file docfx.json found, start generating metadata...
[18-01-19 02:56:46.006]Info:[ExtractMetadata]Loading projects...
[18-01-19 02:56:46.785]Warning:[ExtractMetadata](/Users/nik/Development/CueX/CueX.API/CueX.API.csproj)Workspace failed with: [Failure] Msbuild failed when processing the file '/Users/nik/Development/CueX/CueX.API/CueX.API.csproj' with message: The type initializer for 'Microsoft.Build.Collections.MSBuildNameIgnoreCaseComparer' threw an exception.
[18-01-19 02:56:46.896]Warning:[ExtractMetadata](/Users/nik/Development/CueX/CueX.Core/CueX.Core.csproj)Workspace failed with: [Failure] Msbuild failed when processing the file '/Users/nik/Development/CueX/CueX.Core/CueX.Core.csproj' with message: The type initializer for 'Microsoft.Build.Collections.MSBuildNameIgnoreCaseComparer' threw an exception.
...

EDIT: I am gonna test setting MSBUILD_EXE_PATH on the linux machine later as well

UPDATE: The output on linux is the same also throwing The type initializer for 'Microsoft.Build.Collections.MSBuildNameIgnoreCaseComparer' threw an exception.

UPDATE: The same docfx.json builds fine on appveyor

@CPlusPlus17
Copy link
Author

I just used a plain project created with Rider for this.
MSBUILD_EXE_PATH overwrite causes the same problem here like in the comment above.

@vicancy
Copy link
Contributor

vicancy commented Jan 22, 2018

Reproed in https://travis-ci.org/docascode/docfx.test, will take a further look into it.

@vicancy vicancy added bug A bug to fix priority-1 fundamental: xplat Cross-platform support labels Jan 22, 2018
@vicancy
Copy link
Contributor

vicancy commented Feb 12, 2018

MSBuild assembly throws this exception when new MSB.Evaluation.ProjectCollection();, need a further look.

@vicancy
Copy link
Contributor

vicancy commented Feb 12, 2018

  1. The reason for throwing "Platform is not supported": should set MSBUILD_EXE_PATH while code sets MSBuild_EXE_PATH.... In Linux, case sensitivity matters.
  2. The other one is in investigating...

@vicancy
Copy link
Contributor

vicancy commented Feb 13, 2018

Root cause identified for The type initializer for 'Microsoft.Build.Collections.MSBuildNameIgnoreCaseComparer' threw an exception:
System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows) returns True under mono with Assembly System.Runtime.InteropServices.RuntimeInformation, Version=4.0.2.0 while returns False under mono with Assembly System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0.... doubt if mono does not support 4.0.2 yet...

vicancy added a commit that referenced this issue Feb 13, 2018
@vicancy
Copy link
Contributor

vicancy commented Feb 13, 2018

One workaround is to specifically use System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0., and use app.config to redirect all the assembly references back to 4.0.1.0. But I doubt if that is a correct fix....

@jaroslaw-weber
Copy link

jaroslaw-weber commented Mar 1, 2018

@vicancy
getting

The type initializer for 'Microsoft.Build.Collections.MSBuildNameIgnoreCaseComparer' threw an exception:
System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows)

under macos. i didnt understand the workaround you provided, could you elaborate? where is app.config?

@vicancy
Copy link
Contributor

vicancy commented Mar 1, 2018

Hi @jaroslaw-weber The workaround is talking about a code level fix. You might wait until we release a fix.

jeromelaban added a commit to unoplatform/Uno.SourceGeneration that referenced this issue Jan 15, 2019
Getting "The type initializer for 'Microsoft.Build.Collections.MSBuildNameIgnoreCaseComparer' threw an exception." , using dotnet/docfx#2358 as a tentative workaround.
jeromelaban added a commit to unoplatform/Uno.SourceGeneration that referenced this issue Jan 15, 2019
Getting "The type initializer for 'Microsoft.Build.Collections.MSBuildNameIgnoreCaseComparer' threw an exception." , using dotnet/docfx#2358 as a tentative workaround.
MatFillion pushed a commit to unoplatform/Uno.SourceGeneration that referenced this issue Jan 30, 2019
Getting "The type initializer for 'Microsoft.Build.Collections.MSBuildNameIgnoreCaseComparer' threw an exception." , using dotnet/docfx#2358 as a tentative workaround.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug to fix fundamental: xplat Cross-platform support
Projects
None yet
Development

No branches or pull requests

4 participants