Bug 41825 - [Cycle 7] "Error while trying to load the project ... Object reference not set to an instance of an object" if `.csproj` tries to evaluate a property function on a return value of a property function
Summary: [Cycle 7] "Error while trying to load the project ... Object reference not se...
Status: VERIFIED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Project Model (show other bugs)
Version: 6.0.0 (C7)
Hardware: PC Mac OS
: --- major
Target Milestone: C7SR1
Assignee: Lluis Sanchez
URL:
Depends on:
Blocks:
 
Reported: 2016-06-14 22:37 UTC by Brendan Zagaeski (Xamarin Team, assistant)
Modified: 2016-08-10 15:32 UTC (History)
4 users (show)

Tags: BZRC7S1_C6SR4S1, DefectEscapeReview_Done
Is this bug a regression?: Yes
Last known good build: Cycle 6 – Service Release 4


Attachments
Test case (1.67 KB, application/zip)
2016-06-14 22:37 UTC, Brendan Zagaeski (Xamarin Team, assistant)
Details
IDE log file and detailed version info (4.42 KB, application/zip)
2016-06-14 22:39 UTC, Brendan Zagaeski (Xamarin Team, assistant)
Details

Description Brendan Zagaeski (Xamarin Team, assistant) 2016-06-14 22:37:47 UTC
Created attachment 16332 [details]
Test case

[Cycle 7] "Error while trying to load the project ... Object reference not set to an instance of an object" if `.csproj` tries to evaluate a property function on a return value of a property function




## Regression status: regression in Cycle 7

> BAD:  Xamarin Studio 6.0    (build 5174) (694a75f040b7f2309bc43d4f78a3a6572ca898bf)
> GOOD: Xamarin Studio 5.10.3 (build 51)   (f3c0d982165f785772d125f02668370d929014fb)




## Steps to replicate

Open the attached test case in Xamarin Studio.


The test case is a new "Other > .NET > Empty Project" with 1 line added to the top `<ProjectGroup>`:

<Foo>$(Bar.Split('.').Length)</Foo>


(Note: `Bar` is intentionally _not_ defined in this example, but defining it doesn't stop the problem either.)




## BAD Results (with Xamarin Studio 6.0)


### Error dialog

> Error while trying to load the project
> '/Users/Shared/Projects/NewProjectModelNRE/EmptyProject1/EmptyProject1.csproj':
> Object reference not set to an instance of an object


### Top of the exception stack trace from the `"$HOME"/Library/Logs/XamarinStudio-6.0/Ide*.log` file

> System.NullReferenceException: Object reference not set to an instance of an object
>   at MonoDevelop.Projects.MSBuild.MSBuildEvaluationContext.EvaluateMember (System.Type type, System.Object instance, System.String str, Int32 i, System.Object& val) [0x0004b] in /Users/builder/data/lanes/3342/694a75f0/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildEvaluationContext.cs:430 
>   at MonoDevelop.Projects.MSBuild.MSBuildEvaluationContext.EvaluateMember (System.Type type, System.Object instance, System.String str, Int32 i, System.Object& val) [0x002db] in /Users/builder/data/lanes/3342/694a75f0/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildEvaluationContext.cs:514 
>   at MonoDevelop.Projects.MSBuild.MSBuildEvaluationContext.EvaluateProperty (System.String prop, System.Object& val) [0x000db] in /Users/builder/data/lanes/3342/694a75f0/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildEvaluationContext.cs:413 
>   at MonoDevelop.Projects.MSBuild.MSBuildEvaluationContext.EvaluateReference (System.String str, System.Int32& i, System.Object& val) [0x0007e] in /Users/builder/data/lanes/3342/694a75f0/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildEvaluationContext.cs:375 




## GOOD Results (with Xamarin Studio 5.10, Visual Studio 2013, or Visual Studio 2015)

The project loads without error.




## Additional version info (brief)

OS X 10.11.5
Mono 4.4.0 (5995f74)
Comment 1 Brendan Zagaeski (Xamarin Team, assistant) 2016-06-14 22:39:10 UTC
Created attachment 16333 [details]
IDE log file and detailed version info
Comment 2 Ryan Niebur 2016-06-15 22:31:51 UTC
One workaround is to change this:
<Foo>$(Bar.Split('.').Length)</Foo>

To this:
<Baz>$(Bar.Split('.'))</Baz>
<Foo>$(Baz.Length)</Foo>
Comment 3 xamarin-release-manager 2016-06-16 08:52:17 UTC
Fixed in version 6.1.0.4736 (master)

Author: Lluis Sanchez
Commit: 2a30b8ebc64bf2dcf1aeb332ea3350ddaa76f453 (mono/monodevelop)
Comment 4 xamarin-release-manager 2016-06-16 08:54:46 UTC
Fixed in version 6.0.2.13 (cycle7)

Author: Lluis Sanchez
Commit: 86566c624a2149b486193dcba62d34137890c967 (mono/monodevelop)
Comment 5 Danish Akhtar 2016-06-22 05:29:05 UTC
I am also able to reproduce this issue with XS 6.0(build 5174). However with XS build XS 6.0.2(build 30) its working fine, we are successfully able to load the attached project in XS.

I'll verify this bug once we get builds for C7 SR1.
Comment 6 Danish Akhtar 2016-06-30 13:07:04 UTC
As this issue is Verified with C7 build in Comment 5. So I am closing this issue.

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.


Create a new report for Bug 41825 on Developer Community or GitHub if you have new information to add and do not yet see a matching report.

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments


Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Related Links: