Bug 31445 - $([MSBuild]::MakeRelative('$(BclSourcesRoot)', '%(Identity)') crashes with empty %(Identity)
Summary: $([MSBuild]::MakeRelative('$(BclSourcesRoot)', '%(Identity)') crashes with em...
Status: NEW
Alias: None
Product: Tools
Classification: Mono
Component: xbuild ()
Version: unspecified
Hardware: PC Other
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-06-28 06:54 UTC by Marcin Cieślak
Modified: 2015-06-28 08:19 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

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.

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.


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

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • 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

Related Links:
Status:
NEW

Description Marcin Cieślak 2015-06-28 06:54:09 UTC
In the CoreCLR's mscorlib.proj we have:

https://github.com/dotnet/coreclr/blob/90198e49936fac468ff42e1dd0a6d96ea666903c/src/mscorlib/mscorlib.csproj#L148-L153

<Compile Include="@(MscorlibSources)">
      <Link>$([MSBuild]::MakeRelative($(BclSourcesRoot), %(Identity))</Link>
</Compile>

even after changing that to

      <Link>$([MSBuild]::MakeRelative('$(BclSourcesRoot)', '%(Identity)')</Link>

MakeRelative crashes because %(Identity) seems to be empty.

Exception log (full log posted to https://gist.github.com/dc63860cc2d8047412b2

        /home/saper/git/coreclr/src/mscorlib/Tools/PostProcessingTools.targets: Importing project /home/saper/git/coreclr/src/mscorlib/Tools/BclRewriter/BclRewriter.targets
/home/saper/git/coreclr/src/mscorlib/mscorlib.csproj: error : /home/saper/git/coreclr/src/mscorlib/mscorlib.csproj: Exception has been thrown by the target of an invocation.
        /home/saper/git/coreclr/src/mscorlib/mscorlib.csproj: Microsoft.Build.BuildEngine.InvalidProjectFileException: /home/saper/git/coreclr/src/mscorlib/mscorlib.csproj: Exception has been thrown by the target of an invocation. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.UriFormatException: Invalid URI: The URI scheme is not valid.
          at System.Uri.Parse (UriKind kind, System.String uriString) [0x00020] in /home/saper/sw/mono/mcs/class/System/System/Uri.cs:1268
          at System.Uri.ParseUri (UriKind kind) [0x00000] in /home/saper/sw/mono/mcs/class/System/System/Uri.cs:1138
          at System.Uri..ctor (System.String uriString, Boolean dontEscape) [0x00059] in /home/saper/sw/mono/mcs/class/System/System/Uri.cs:256
          at System.Uri..ctor (System.String uriString) [0x00000] in /home/saper/sw/mono/mcs/class/System/System/Uri.cs:152
          at Microsoft.Build.BuildEngine.PredefinedPropertyFunctions.MakeRelative (System.String basePath, System.String path) [0x0004e] in /home/saper/sw/mono/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/PredefinedPropertyFunctions.cs:161
          at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
          at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00038] in /home/saper/sw/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:295
          --- End of inner exception stack trace ---
          at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0004d] in /home/saper/sw/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:303
          at System.RuntimeType.InvokeMember (System.String name, BindingFlags bindingFlags, System.Reflection.Binder binder, System.Object target, System.Object[] providedArgs, System.Reflection.ParameterModifier[] modifiers, System.Globalization.CultureInfo culture, System.String[] namedParams) [0x00870] in /home/saper/sw/mono/external/referencesource/mscorlib/system/rttype.cs:5103
          at System.Type.InvokeMember (System.String name, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object target, System.Object[] args, System.Globalization.CultureInfo culture) [0x00000] in /home/saper/sw/mono/external/referencesource/mscorlib/system/type.cs:334
          at Microsoft.Build.BuildEngine.MemberInvocationReference.Invoke (Microsoft.Build.BuildEngine.Project project, ExpressionOptions options) [0x00122] in /home/saper/sw/mono/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/MemberInvocationReference.cs:109
          at Microsoft.Build.BuildEngine.MemberInvocationReference.ConvertToString (Microsoft.Build.BuildEngine.Project project, ExpressionOptions options) [0x00000] in /home/saper/sw/mono/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/MemberInvocationReference.cs:59
          at Microsoft.Build.BuildEngine.ExpressionCollection.ConvertToString (Microsoft.Build.BuildEngine.Project project, ExpressionOptions options) [0x00047] in /home/saper/sw/mono/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ExpressionCollection.cs:147
          at Microsoft.Build.BuildEngine.ExpressionCollection.ConvertToNonArray (Microsoft.Build.BuildEngine.Project project, System.Type type, ExpressionOptions options) [0x00000] in /home/saper/sw/mono/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ExpressionCollection.cs:98
          at Microsoft.Build.BuildEngine.ExpressionCollection.ConvertTo (Microsoft.Build.BuildEngine.Project project, System.Type type, ExpressionOptions options) [0x00051] in /home/saper/sw/mono/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ExpressionCollection.cs:86
          at Microsoft.Build.BuildEngine.Expression.ConvertTo (Microsoft.Build.BuildEngine.Project project, System.Type type, ExpressionOptions options) [0x00000] in /home/saper/sw/mono/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Expression.cs:633
          at Microsoft.Build.BuildEngine.BuildItem.AddMetadata (System.String name, System.String value) [0x0002c] in /home/saper/sw/mono/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildItem.cs:273
          at Microsoft.Build.BuildEngine.BuildItem.Evaluate (Microsoft.Build.BuildEngine.Project project, Boolean evaluatedTo) [0x0005d] in /home/saper/sw/mono/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildItem.cs:301
          at Microsoft.Build.BuildEngine.BuildItemGroup.Evaluate () [0x00045] in /home/saper/sw/mono/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildItemGroup.cs:277
          at Microsoft.Build.BuildEngine.GroupingCollection.EvaluateBuildItemGroup (Microsoft.Build.BuildEngine.BuildItemGroup big) [0x00027] in /home/saper/sw/mono/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/GroupingCollection.cs:223
          at Microsoft.Build.BuildEngine.GroupingCollection.Evaluate (EvaluationType type) [0x0007f] in /home/saper/sw/mono/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/GroupingCollection.cs:190
          at Microsoft.Build.BuildEngine.GroupingCollection.Evaluate () [0x00007] in /home/saper/sw/mono/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/GroupingCollection.cs:166
          at Microsoft.Build.BuildEngine.Project.Evaluate () [0x00000] in /home/saper/sw/mono/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs:974
          at Microsoft.Build.BuildEngine.Project.ProcessXml () [0x000c3] in /home/saper/sw/mono/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs:889
          at Microsoft.Build.BuildEngine.Project.DoLoad (System.IO.TextReader textReader) [0x0012c] in /home/saper/sw/mono/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs:853
          --- End of inner exception stack trace ---
          at Microsoft.Build.BuildEngine.Project.DoLoad (System.IO.TextReader textReader) [0x00144] in /home/saper/sw/mono/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs:856
          at Microsoft.Build.BuildEngine.Project.Load (System.String projectFileName, ProjectLoadSettings settings) [0x0012a] in /home/saper/sw/mono/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs:542
          at Microsoft.Build.BuildEngine.Project.Load (System.String projectFileName) [0x00000] in /home/saper/sw/mono/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs:508
          at Microsoft.Build.BuildEngine.Engine.BuildProjectFileInternal (System.String projectFile, System.String[] targetNames, Microsoft.Build.BuildEngine.BuildPropertyGroup globalProperties, IDictionary targetOutputs, BuildSettings buildFlags, System.String toolsVersion) [0x000b9] in /home/saper/sw/mono/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Engine.cs:285
          at Microsoft.Build.BuildEngine.Engine.BuildProjectFile (System.String projectFile, System.String[] targetNames, Microsoft.Build.BuildEngine.BuildPropertyGroup globalProperties, IDictionary targetOutputs, BuildSettings buildFlags, System.String toolsVersion) [0x00008] in /home/saper/sw/mono/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Engine.cs:234
      Task "MSBuild" execution -- FAILED
Comment 1 Marcin Cieślak 2015-06-28 08:19:48 UTC
From the debugger:

Hit breakpoint at '/home/saper/sw/mono/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/MemberInvocationReference.cs:109'
#0 [0x00000122] Microsoft.Build.BuildEngine.MemberInvocationReference.Invoke at /home/saper/sw/mono/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/MemberInvocationReference.cs:109
                                value = type.InvokeMember (member_name, flags, null, target, args, CultureInfo.InvariantCulture);
(sdb) print member_name
string it = "MakeRelative"

(sdb) print args[0]
string it = "/home/saper/git/coreclr/src/mscorlib/src"
(sdb) print args[1]
string it = "%(Identity)"