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

Error running "pac" commands on Apple M1 with dotnet 6.0 arm64 sdk installed #139

Closed
cathalnoonan opened this issue Dec 1, 2021 · 6 comments
Labels
bug Something isn't working crossplatform issues specific to non-Windows OS: macOS, linux

Comments

@cathalnoonan
Copy link

Hi,

The pac commands have started to throw errors on Apple M1 device after installing the arm64 version of the dotnet 6.0 SDK (this is recommended by the release notes of Visual Studio 2022 for Mac Preview 3).

The error being thrown is:

It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '5.0.0' (arm64) was not found.
  - The following frameworks were found:
      6.0.0 at [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

You can resolve the problem by installing the specified framework and/or SDK.

The specified framework can be found at:
  - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=5.0.0&arch=arm64&rid=osx.11.1-arm64
Unhandled exception. Microsoft.PowerPlatform.Tooling.BatchedTelemetry.AppTelemetryException: Telemetry upload process has failed with exit code 150. This usually indicates a deployment configuration issue.
   at Microsoft.PowerPlatform.Tooling.BatchedTelemetry.TelemetryChannel.BatchedTelemetryChannel.ThrowIfUploadProcessHasExitedWithFailure()
   at Microsoft.PowerPlatform.Tooling.BatchedTelemetry.TelemetryChannel.BatchedTelemetryChannel.StartUploadProcess()
   at Microsoft.PowerPlatform.Tooling.BatchedTelemetry.TelemetryChannel.BatchedTelemetryChannel.Flush()
   at Microsoft.PowerPlatform.Tooling.BatchedTelemetry.TelemetryChannel.BatchedTelemetryChannel.Dispose(Boolean disposing)
   at Microsoft.PowerPlatform.Tooling.BatchedTelemetry.TelemetryChannel.BatchedTelemetryChannel.Dispose()
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.Dispose()
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.Dispose()
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.Dispose()
   at bolt.cli.Session.Dispose(Boolean disposing)
   at bolt.cli.Session.Dispose()
   at bolt.Program.Main(String[] args)

Going by the error message, it seems that pac is looking for an arm64 version of dotnet 5.0, which does not exist for macOS, and since that version is not installed it throws an error.

Others have reported similar compatibility issues in the dotnet/installer repo, issue 12187.

A workaround from the issue linked above is to call export DOTNET_ROLL_FORWARD=LatestMajor, which is documented here.

After adding the DOTNET_ROLL_FORWARD workaround, dotnet will look for the latest major version of dotnet installed on the system; which at the moment would be dotnet 6.0 arm64, rather than attempting to find a compatible version of dotnet 5.0.

As an example, running the pac telemetry status command before and after calling the workaround:
image


macOS (Intel and M1) support is mentioned in the blog post announcing the public preview of this extension so this error message may be something other users have encountered also.

@davidjenni
Copy link
Member

@cathalnoonan thanks for reporting! Yes, we got blind sided: I'm happy .NET 6 is out with native M1 support, but a bit saddened that the cross-over for 5.x apps is somewhat bumpy. We're already moving the pac CLI from net5 to net6, but the current public release, 1.9.9, and the soon to be published 1.10.x (Nov refresh) that will be included in the next VS Code extension will still only target .net5.

Existing intel-based macs are not affected by this (pac still works on my old private MBP w/ Intel and .NET 6, which keeps the .net5 runtime installed), but reproes on my MPB M1 as well.

My current work-around:

  • install the latest .NET 6.0 amd64 SDK (http://aka.ms/dotnet-download)
  • install the .NET 6.0 for x64 SDK as well (side-by-side, well, technically, subfolder within /usr/local/shared/dotnet)
  • edit the *.runtimeconfig.json for both the pac and pacTelemetryUpload executables:
    • determine location of the 2 executables (same folder):
    > which pac
    /Users/davidjen/Library/Application\ Support/Code/globalStorage/microsoft-isvexptools.powerplatform-vscode/pac/tools/pac
    
    • capture its path into an env variable, e.g. on bash/zsh
      > PACPATH=$(dirname -- "$(which pac)")
      
    • edit the 2 .runtimeconfig.json and replace line 3 and line 6 the values for net5.0, resp. 5.0.0 with: net6.0 and 6.0.0 and save:
    > $EDITOR $PACPATH/pac.runtimeconfig.json
    > $EDITOR $PACPATH/pacTelemetryUpload.runtimeconfig.json

Now e.g. pac auth list etc will both get launched ok, and the exception stack when trying to upload the telemetry won't occur.

One side note: Since I had some pre-release version of NET6.0, I prefixed the above workaround by first uninstalling any previous dotnetCore versions (SDK and runtime) I had installed:

We'll try to detect and encode this temporary work around into the next VS Code refresh, or at the very least release note it. The real fix is to move pac CLI onto NET 6.0 since it is the new LTS for dotnetCore

@davidjenni davidjenni added bug Something isn't working crossplatform issues specific to non-Windows OS: macOS, linux labels Dec 7, 2021
@cathalnoonan
Copy link
Author

@davidjenni - Thanks for the suggestion

Rather than calling export DOTNET_ROLL_FORWARD=LatestMajor in each terminal session, I have added the previous workaround to the ~/.zshrc file so it is called automatically for each terminal session:
image

Your workaround makes sense because it focusses on fixing pac and the pac telemetry tools, rather than affecting any other installed tools that rely on dotnet

Thanks for the feedback!

@davidjenni
Copy link
Member

davidjenni commented Dec 8, 2021

@cathalnoonan after some more experiments, we're going with the DOTNET_ROLL_FORWARD env var that will be setup only for VSCode terminals, we cannot be too presumptuous and take over the user's machine :-)
See dotnet/installer#141 with @tehcrashxor's fix

@cathalnoonan
Copy link
Author

@davidjenni, @tehcrashxor - This is working as expected, thanks for the fix! Closing the issue

@getangar
Copy link

Hi, I have the same error and it seems that the workaround hasn't worked for me.
Actually I have installed on my Mac:

.NET SDKs
6.0.408 [/usr/local/share/dotnet/sdk]
7.0.203 [/usr/local/share/dotnet/sdk]

.NET Runtimes:
Microsoft.AspNetCore.App 6.0.16 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.16 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

When executing "pac" I have the following error:

You must install .NET to run this application.

App: /Users/gennaro/Library/Application Support/Code/User/globalStorage/microsoft-isvexptools.powerplatform-vscode/pac/tools/pac
Architecture: x64
App host version: 6.0.16
.NET location: Not found

Learn about runtime installation:
https://aka.ms/dotnet/app-launch-failed

Download the .NET runtime:
https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=osx.13-x64&apphost_version=6.0.16

@cathalnoonan
Copy link
Author

@getangar The wrong version of dotnet might be being used (i.e. dotnet 7.0.x instead of dotnet 6.0.x).

What output do you get for these two commands?

  • dotnet --info
  • dotnet --version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working crossplatform issues specific to non-Windows OS: macOS, linux
Projects
None yet
Development

No branches or pull requests

3 participants