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

Telemetry target fails in rc1 #90584

Closed
rolfbjarne opened this issue Aug 15, 2023 · 2 comments · Fixed by #90588
Closed

Telemetry target fails in rc1 #90584

rolfbjarne opened this issue Aug 15, 2023 · 2 comments · Fixed by #90588

Comments

@rolfbjarne
Copy link
Member

rolfbjarne commented Aug 15, 2023

Description

Build failure:

/Users/builder/azdo/_work/1/s/xamarin-macios/builds/downloads/dotnet-sdk-8.0.100-rc.1.23414.11/sdk-manifests/8.0.100-rc.1/microsoft.net.workload.mono.toolchain.current/8.0.0-rc.1.23414.4/WorkloadTelemetry.targets(41,27): error MSB4186: Invalid static method invocation syntax: "[System.IO.Path]::GetFileName().ToLower()". Method 'System.IO.Path.GetFileName' not found. Static method invocation should be of the form: $([FullTypeName]::Method()), e.g. $([System.IO.Path]::Combine(a, b)). Check that all parameters are defined, are of the correct type, and are specified in the right order. [/Users/builder/azdo/_work/1/s/xamarin-macios/tests/dotnet/MySimpleApp/MacCatalyst/MySimpleApp.csproj]

Binlog:
log-publish-20230815_052259.binlog.zip

Reproduction Steps

This seems to happen when doing dotnet publish for universal macOS and Mac Catalyst projects.

I'm guessing the reason is that the outer build doesn't do what normal builds do, and the ReferencePath item group is empty:

<_WorkloadUsesOther Condition="'$([System.IO.Path]::GetFileName(%(ReferencePath.Identity)).ToLower())' == 'avalonia.dll'">true</_WorkloadUsesOther>
<_WorkloadUsesOther Condition="'$([System.IO.Path]::GetFileName(%(ReferencePath.Identity)).ToLower())' == 'uno.dll'">true</_WorkloadUsesOther>

thus MSBuild failing to find the method "System.IO.Path.GetFileName()" (the method with 0 arguments).

Expected behavior

Successful build.

Actual behavior

Broken build.

Regression?

Yes.

Known Workarounds

No response

Configuration

This happens in our latest dotnet/installer bump: xamarin/xamarin-macios#18607.

Other information

I'm guess the fix would be to quote the arguments to GetFileName:

      <_WorkloadUsesOther Condition="'$([System.IO.Path]::GetFileName('%(ReferencePath.Identity')).ToLower())' == 'avalonia.dll'">true</_WorkloadUsesOther>
      <_WorkloadUsesOther Condition="'$([System.IO.Path]::GetFileName('%(ReferencePath.Identity')).ToLower())' == 'uno.dll'">true</_WorkloadUsesOther>

So that the method resolution to System.IO.Path.GetFileName looks for the method with a single string parameter, even if %(ReferencePath.Identity) is empty.

(that probably doesn't work as-is, because the new quotes would have to be escaped somehow).

This was probably introduced in #90208.

@ghost ghost added the untriaged New issue has not been triaged by the area owner label Aug 15, 2023
@ghost
Copy link

ghost commented Aug 15, 2023

Tagging subscribers to this area: @dotnet/area-system-io
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

Build failure:

/Users/builder/azdo/_work/1/s/xamarin-macios/builds/downloads/dotnet-sdk-8.0.100-rc.1.23414.11/sdk-manifests/8.0.100-rc.1/microsoft.net.workload.mono.toolchain.current/8.0.0-rc.1.23414.4/WorkloadTelemetry.targets(41,27): error MSB4186: Invalid static method invocation syntax: "[System.IO.Path]::GetFileName().ToLower()". Method 'System.IO.Path.GetFileName' not found. Static method invocation should be of the form: $([FullTypeName]::Method()), e.g. $([System.IO.Path]::Combine(a, b)). Check that all parameters are defined, are of the correct type, and are specified in the right order. [/Users/builder/azdo/_work/1/s/xamarin-macios/tests/dotnet/MySimpleApp/MacCatalyst/MySimpleApp.csproj]

Binlog:
log-publish-20230815_052259.binlog.zip

Reproduction Steps

This seems to happen when doing dotnet publish for universal macOS and Mac Catalyst projects.

I'm guessing the reason is that the outer build doesn't do what normal builds do, and the ReferencePath item group is empty:

<_WorkloadUsesOther Condition="'$([System.IO.Path]::GetFileName(%(ReferencePath.Identity)).ToLower())' == 'avalonia.dll'">true</_WorkloadUsesOther>
<_WorkloadUsesOther Condition="'$([System.IO.Path]::GetFileName(%(ReferencePath.Identity)).ToLower())' == 'uno.dll'">true</_WorkloadUsesOther>

thus MSBuild failing to find the method "System.IO.Path.GetFileName()" (the method with 0 arguments).

Expected behavior

Successful build.

Actual behavior

Broken build.

Regression?

Yes.

Known Workarounds

No response

Configuration

This happens in our latest dotnet/installer bump: xamarin/xamarin-macios#18607.

Other information

I'm guess the fix would be to quote the arguments to GetFileName:

      <_WorkloadUsesOther Condition="'$([System.IO.Path]::GetFileName('%(ReferencePath.Identity')).ToLower())' == 'avalonia.dll'">true</_WorkloadUsesOther>
      <_WorkloadUsesOther Condition="'$([System.IO.Path]::GetFileName('%(ReferencePath.Identity')).ToLower())' == 'uno.dll'">true</_WorkloadUsesOther>

So that the method resolution to System.IO.Path.GetFileName looks for the method with a single string parameter, even if %(ReferencePath.Identity) is empty.

(that probably doesn't work as-is, because the new quotes would have to be escaped somehow).

Author: rolfbjarne
Assignees: -
Labels:

area-System.IO, untriaged

Milestone: -

@rolfbjarne
Copy link
Member Author

CC @steveisok

rolfbjarne added a commit to xamarin/xamarin-macios that referenced this issue Aug 15, 2023
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Aug 15, 2023
steveisok pushed a commit to steveisok/runtime that referenced this issue Aug 15, 2023
There are cases where `%(ReferencePath)` is empty, so prevent exceptions by quoting the value.

Fixes dotnet#90584
github-actions bot pushed a commit that referenced this issue Aug 15, 2023
There are cases where `%(ReferencePath)` is empty, so prevent exceptions by quoting the value.

Fixes #90584
carlossanlop pushed a commit that referenced this issue Aug 16, 2023
… collecting telemetry (#90606)

* [workloads] Put quotes around GetFileName call when collecting telemetry

There are cases where `%(ReferencePath)` is empty, so prevent exceptions by quoting the value.

Fixes #90584

* Feedback

---------

Co-authored-by: Steve Pfister <steve.pfister@microsoft.com>
Co-authored-by: Steve Pfister <steveisok@users.noreply.github.com>
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Aug 16, 2023
steveisok added a commit that referenced this issue Aug 16, 2023
…try (#90588)

There are cases where `%(ReferencePath)` is empty, so prevent exceptions by quoting the value.

Fixes #90584
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Aug 16, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Sep 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants