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

VS2019 only: NullReferenceException when generating API for DotNet Standard and Core projects #4869

Closed
mnoreke opened this issue Jul 13, 2019 · 7 comments

Comments

@mnoreke
Copy link

mnoreke commented Jul 13, 2019

Operation System: Windows
DocFX Version Used: 2.43.2.0

Steps to Reproduce:

  1. Download the docfx-seed repository
  2. Remove everything in the src directory
  3. Copy an existing .Net Core (2.2) or .Net Standard (2.0) into the src directory
  4. Update the docfx.yml file to use "files": [ "/*.sln", ".*.csproj" ],
  5. Run docfx.exe docfx.json

Expected Behavior:
API is processed

Actual Behavior:
Warning: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.. Ignored.
followed by:
Error: System.NullReferenceException: Object reference not set to an instance of an object.

I downloaded the source, and the warning occurs in ExtractMetaDataWorker at line 82 with an inner exception of:
{"Could not load file or assembly 'Microsoft.Build.Framework, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.":"Microsoft.Build.Framework, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"}

I do not have VS2017 installed, only VS2019. The release notes show that this is to be supported as of Version 2.43.1 (fixed by issue #4437).

@mnoreke mnoreke changed the title VS21019 only: NullReferenceException when generating API for DotNet Standard and Core projects VS2019 only: NullReferenceException when generating API for DotNet Standard and Core projects Jul 13, 2019
@Shazwazza
Copy link

we have what appears to the same issue. Only VS 2019 installed, both preview and normal. This is the full error

Build failed.
[19-08-19 12:24:30.242]Warning:[MetadataCommand.ExtractMetadata](C:/Users/Shannon/Documents/_Projects/Lucene.Net/Lucenenet.4.x-copy/src/Lucene.Net/Lucene.Net.csproj)Error opening project C:/Users/Shannon/Documents/_Projects/Lucene.Net/Lucenenet.4.x-copy/src/Lucene.Net/Lucene.Net.csproj: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.. Ignored.
[19-08-19 12:24:30.244]Warning:[MetadataCommand.ExtractMetadata](C:/Users/Shannon/Documents/_Projects/Lucene.Net/Lucenenet.4.x-copy/src/Lucene.Net.Misc/Lucene.Net.Misc.csproj)Error opening project C:/Users/Shannon/Documents/_Projects/Lucene.Net/Lucenenet.4.x-copy/src/Lucene.Net.Misc/Lucene.Net.Misc.csproj: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.. Ignored.
[19-08-19 12:24:30.249]Error:Error extracting metadata for C:/Users/Shannon/Documents/_Projects/Lucene.Net/Lucenenet.4.x-copy/src/Lucene.Net/Lucene.Net.csproj,C:/Users/Shannon/Documents/_Projects/Lucene.Net/Lucenenet.4.x-copy/src/Lucene.Net.Misc/Lucene.Net.Misc.csproj: System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.DocAsCode.Metadata.ManagedReference.ExtractMetadataWorker.<SaveAllMembersFromCacheAsync>d__13.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.DocAsCode.Metadata.ManagedReference.ExtractMetadataWorker.<ExtractMetadataAsync>d__11.MoveNext()
        2 Warning(s)
        1 Error(s)

The build used to work with 2.38.1 but having to jump through some hoops with 2017 build tools and custom env vars used ... but this does not work with azure pipelines.

@ascholz
Copy link

ascholz commented Sep 17, 2019

We have the same problem. Is there any information until when the bug will be fixed?

@superyyrrzz
Copy link
Contributor

It looks like missing a required component in VS 2019. Could you try install Build Tools for VS2019

@sdobart
Copy link

sdobart commented Oct 9, 2019

Installing Build Tools VS2019 does not solve the issue (also dealing with this).

@Shazwazza
Copy link

This worked for me, i had to install VS2019 build tools and i also had to ensure that NET Core build tools were installed too (see image dotnet/msbuild#2532 (comment))

I also had to make sure the other hacks like setting VSINSTALLDIR env vars were not happening.

I just don't understand why this all doesn't 'just work' by having full Visual Studio installed, why would i also need build tools?

@superyyrrzz
Copy link
Contributor

@Shazwazza This is tracked in #4782. I will fix it soon.

I also had to make sure the other hacks like setting VSINSTALLDIR env vars were not happening.

@superyyrrzz
Copy link
Contributor

tracked in #4782

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants