SHFB : error BE0065: BUILD FAILED: Object reference not set to an instance of an object when building from Visual Studio

Topics: Developer Forum
Jun 8, 2011 at 5:57 AM

I have a solution that includes a documentation project (shfb project).

Untill recently this have been working just fine, but when i came back to do some small changes to the project the project fails to build with the following info:

SHFB : error BE0065: BUILD FAILED: Object reference not set to an instance of an object.

Building the file directly in SHFB works fine, this error is only present when building from Visual Studio (MSBuild).
Crancking up the MSbuild verbosity does not seem to help much, the error comes right after "ValidatingDocumentationSources" (probably in that step).

Any clue on how to debug this issue?

I had a look at what I did to the assemblies or documentation content files recently, and the thing is I did nothing, i even rolled back to a version where I know everything works (last published build).
I did do one thing though, and that was to upgrade to the newest version of SHFB.

 

Content of LastBuild.log:

<?xml version="1.0" encoding="utf-8"?>
<shfbBuild product="Sandcastle Help File Builder Utilities" version="1.9.3.0" projectFile="C:\Code\Infosoft\InfoSystem\Maintenance\Infosystem-2.5\ServicePack\UserRegister\Documentation\UserRegister.SandCastle.csproj" started="08.06.2011 07:56:42">
<buildStep step="Initializing">
Loading and initializing plug-ins...
Hierarchical Table of Contents Version 1.9.3.0
Copyright &#169; 2006-2011, Eric Woodruff, All Rights Reserved
</buildStep>
<buildStep step="FindingTools">
Finding tools...
Found Sandcastle tools in &#39;C:\Program Files (x86)\Sandcastle\&#39;
</buildStep>
<buildStep step="ValidatingDocumentationSources">
Validating and copying documentation source information
Source: C:\Code\Infosoft\InfoSystem\Maintenance\Infosystem-2.5\ServicePack\UserRegister\Source\Service Interface\UR.DataContracts\UR.DataContracts.csproj
    Found project &#39;C:\Code\Infosoft\InfoSystem\Maintenance\Infosystem-2.5\ServicePack\UserRegister\Source\Service Interface\UR.DataContracts\UR.DataContracts.csproj&#39;
    Last step completed in 00:00:00.0000
</buildStep>
<buildStep step="Failed">

SHFB: Error BE0065: BUILD FAILED: Object reference not set to an instance of an object.

</buildStep>
</shfbBuild>

Coordinator
Jun 8, 2011 at 3:16 PM

Can you send me a copy of your SHFB project and the Visual Studio solutions/projects that its using as documentation sources?  I don't need any of the code or assemblies, just enough to run through the parsing of the project files to see where it is failing during the validation step.  My e-mail address is in the About box in the GUI and in the footer of the pages in the help file.

Eric

 

Jun 9, 2011 at 1:05 PM

Email sent. Hope you can get an idea from the parser.

Jun 14, 2011 at 7:12 AM

Having the same problem - have you managed to find what is causing it?

Jun 14, 2011 at 10:47 AM

I am still awaiting a reply from Eric. I sent the e-mail thursday, so not sure he had the time to even look at it yet.
I am sure he will post an update once he has any feedback.

Coordinator
Jun 15, 2011 at 2:08 AM

I haven't had a chance to look at it yet.  I should be able to get to it this weekend.

Eric

 

Jun 22, 2011 at 11:41 AM

Any luck?

Jun 23, 2011 at 12:30 PM

Getting the same error here on a project created from scratch today.

Jun 24, 2011 at 7:48 AM

Also getting the same error, upgraded to latest (alpha) release of shfb and installed Visual Studio 2010 extension yesterday, added new SHFB project to existing solution, but unable to build SHFB project: Error 1 BUILD FAILED: Object reference not set to an instance of an object. File: SHFB Line: 0 Column: 1 Project: Documentation. I am able to buid using SHFB directly.

I'm really hoping Eric is able to find a solution?!?

Thanks in advance...

Coordinator
Jun 26, 2011 at 10:15 PM

@esben:

Your project does not appear to be valid.  It looks like you've customized it in some way as SHFB uses a .shfbproj extension and does not support .csproj files.  It's possible Visual Studio added or modified the project in some way based on the .csproj extension so that it is not compatible with SHFB.  If you want to use Visual Studio to build a SHFB project file, you'll need to use the v1.9.3.1 alpha release of SHFB which provides the necessary VSPackage to implement it correctly.  Project files prior to that release were not supported from within Visual Studio.

@Luke888 and DigitalTeapot:

If you can send me the .shfbproj and the Visual Studio .sln and/or .*proj files as an example, I'll take a look at them.  I don't need any of the code or assemblies, just enough to run through the parsing of the project files to see where it is failing during the validation step. My e-mail address is in the About box in the GUI and in the footer of the pages in the help file.

Eric

 

Jun 27, 2011 at 4:57 AM

All i did was rename the .shfbproj file to .csproj to have it appear as a project within visual studio. I guess Visual Studio have modified it some way then.
I will try undoing the changes Visual Studio made and have another go at it..

Jun 27, 2011 at 5:56 AM

I Upgraded to build 1931, created a new project using the visual studio integration. Exact same error, this time i did no fidling with the project file so it should be okay.
It builds from SHFB but not from VS2010.

Regarding my "renamed" project of before, the weird thing is that it used to work before I upgraded to build 1930 (and later 1931) .

I will send you the new shfbproj file for examination.

Jun 27, 2011 at 2:02 PM

Just to add - along with SHFB GUI, it also works with MsBuild called from command line and with TFS build (at least in my case), only when building directly from VS it fails.

Jun 28, 2011 at 9:20 AM

Hi Eric

Email sent. Hope the files help to trace the problem.

Jul 22, 2011 at 4:38 PM

I just encountered the same problem, and tried to find the cause.

The exception occurs in MSBuildProject.SetConfiguration(string configuration, string platform, string outDir) because the msBuildProject variable is null.

In the constructor the matchingProject is not assigned to msBuildProject if found.

 

Jul 26, 2011 at 1:25 PM

I had the same issue, for now i have patched it locally for now, so we can use it internally.

I created a bug report and a follow up including my findings here a while ago.

http://shfb.codeplex.com/workitem/30850

I have not had any reaction to it at all so far.

Coordinator
Jul 27, 2011 at 1:33 AM

I've checked the changes that fix this into source control.  Case 2 in the work item is caused by the documentation project using the Any CPU platform rather than the x86 platform used by the console mode project.  Changing it to x86 in the solution's configuration manager wouldn't stick for some reason but explicitly setting it in the Platform property of the documentation source in the documentation project corrected it.  I updated the warning to show the configuration and platform it used to try and find doc sources so that it's more apparent why it failed.

Eric

Aug 31, 2011 at 10:18 AM

Got around to installing the latest alpha build, and my problem has been resolved (Case 3 as noted by Christasch).