-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
dotnet tool install
doesn't understand multi-arch systems or TFM requirements
#26417
Comments
Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov Issue DetailsA user of the .NET global tool vsmac-cli reported the following host error when trying to use the tool after installing it.
This error occurred because the app is framework dependent and the end user does not have the required framework installed. This is likely a common scenario for end users, yet the message is needlessly complex, with implementation details (libhostfxr) and irrelevant information (self-contained vs shared) that appears to be targeted at the developer of the app. This provided URL also appears to be incorrect, as the app's manifest does not allow it to be run with 6.x. I would suggest that the error be more specifically targeted at helping end users understand the problem and resolve it e.g. something like
|
I can agree about the message but you also touched on a different issue - on macOS/ARM the global tools depend on the x64 version of the runtime. That's unintuitive and sometimes even quite harmful (eg. installing dotnet-sos installs extensions for x64 lldb). I suspect it was some last minute change because of signing issues because most .NET 6 previews didn't behave that way. @richlander do you happen to know if there's any issue related to that? (Acquiring a tool through |
It implies a runtime is installed, but not necessarily the one required by the tool, which is constrained by its roll-forward policy. |
I suspect that this tool is cross the Intel/Apple arch boundary. My guess is that |
I am well aware of the roll forward policy. It's customary to set it on dotnet tools.
That's my point. Look for example at the dotnet-sos NuGet. It has binaries for osx-arm64 and yet if you run (FWIW the dotnet tools don't distribute the host executable, neither does the vsmac-cli NuGet.) |
This is news to me. I don’t think there’s anything at the host level which would constrain this — global tools should be creating the appropriate host for the platform. The only exception is 3.1/5.0 apps, which don’t have an ARM64 version at all. If this isn’t a 5.0 app it sounds like a bug. |
Note: both packages are compiled as |
Roll forward is about version resolution, which happens much later then dotnet tool installation, so that isn’t used to determine installation architecture. I’ll leave it up to the tool-install team to decide if they want to make roll forward an installation concept as well. However, for tools with native binaries (which may include SOS) there really isn’t another option — you have to have x64 installed. |
I understand that. However, up until net6.0 GA the behavior was to install the platform specific host with no exceptions. Specifically, no exception for osx-arm64. I understand some reasoning about why the exception was put in place but I haven't seen any discussion about it. Hence why I ask whether it's documented or filed as an issue.
The problem is that the tool does contain osx-arm64 native binaries but they are never used with the x64 host. The whole tool is likely still targeting netcoreapp3.1 for backwards compatibility. So on arm64 host it never installs the correct LLDB binaries with the current behavior effectively making it quite useless (apart from a scenario where you use x64 lldb under Rosetta with x64 dotnet binaries running under Rosetta). |
This is a broken package. You cannot have OS X ARM64 native assets with a netcoreapp3.1 target in a supported way. FYI @tommcdon |
I didn’t know we installed a host at all pre 6.0. I think installing one now is more of an implementation detail, to cope with multiple architecture deployment. @marcpopMSFT to comment on that |
How is one supposed to make it correct though? Specifically, how is one supposed to produce a global tool that installs on all supported .NET versions (or for simplicity, net5.0 and net6.0) and still use arm64 runtime if running on Apple Silicon Mac? Should the NuGet contain duplicate set of binaries with one of them in the net5.0 directory and the other in net6.0 directory? |
@mhutch Sorry for tainting the ticket and going astray from the original issue (error message). I thought that there were already relevant issues about the global tool deployment and I'd just get redirected to them. I believe that in the case of vsmac-cli it would be beneficial if it run with the native runtime on osx-arm64 without going through the hoop of installing a package for non-native architecture. |
The behaviour where the global tools on macOS arm64 installing a x64 host is actually somewhat related to the error message being so bad. Because there is no runtime (or
|
They would be multi-targeted, so they wouldn't be duplicated (they would reference 6.0 versions), but yes. Multi-targeting is the preferred way of supporting multiple frameworks. |
A bit tangential, but perhaps we should have a build warning for global tools that don't do major version roll-forward. I have it set on another of my global tools (dotnet-t4) but missed it on this one - it's pretty easy to do so. |
I didn't see an answer to my question. It is true @mhutch that you have only Arm64 and no x64 installed? I am assuming but want to check. |
This isn't my machine, the error was reported to me (I don't have an M1 myself). I'll ask for details, but the following was also reported and may be relevant:
This is consistent with the error in this particular case being related to a missing version of the runtime rather than a missing architecture, though I expect a missing architecture would result in similar errors. |
From the host side, this error should only be shown when we can't find a runtime (of the matching architecture) at all. That is why I'm thinking it is not just a missing version, but a missing runtime. When we find a runtime, but not a compatible framework/version, the error would have more information (like the framework and version that are missing).
This may be related to what @agocke was saying, where before 6.0, there was no ARM64 host, so the user would end up with the x64 host. But after switching to target |
cc: @richlander It was my machine that I received this error on, here is a screenshot of my terminal session prior to installing the .Net 5 x64 runtime: Interestingly enough the .Net 5 runtime is still not displayed when I run the |
That's giving us some of the info we need. We really need to know if you have an x64 .NET installed. Can you share a directory listing of One change we should consider is augmenting We should also ensure all of our error messages include architecture, including when they mismatch. |
Stepping back one step. The experience you are seeing is always going to be an error, by design. The goal here is to provide a clearer error that directs the user towards self-help. That's what the issue title describes already, so I'm not stating anything novel, just a reminder to anyone reading this. |
The
There are some difficulties with this approach:
I don't know how the The fact that .NET 5 runtime is not listed in |
Ya. I'd like that, but I haven't heard anyone ask for it. I suspect that this space is too complicated for folks to connect all the dots that this could be a good/reasonable UX. Once we improve the roll-forward UX (dotnet/designs#259) then I think more people will use it. That said, the whole problem is going to disappear for most users when 3.1 and 5.0 go EOL (later this year).
@elinor-fung and I talked about this. We're proposing a much simpler solution to that, just a boolean check of which architectures exist (and report the result in |
I would have asked for it...but it worked in the .NET 6 previews up until some moment. Admittedly it may have worked because it didn't check the TFM but it definitely changed at last minute. |
It did "work" until late in the game, until the design was implemented. See: https://github.com/dotnet/designs/blob/main/accepted/2021/x64-emulation-on-arm64/x64-emulation.md#rely-on-implicit-rid-defaults The old approach made the roll-forward experience much better, but it made the other experience of jumping arches effectively impossible. |
I understand that. My point is that you likely didn't hear much complaints also due to the fact that the most active people were on the preview versions. I installed most of the global tools before the design was implemented and so they are already installed with the ARM64 app hosts. I only noticed the change after several months when I needed one more additional tool. |
Fair enough. We're definitely still open to improvements in this area. I assert that the design we have now has the right foundational behavior, so its a question of how we can approve the UX from there. The easiest thing is to raise scenarios that don't work or are inconvenient. |
Similar issue where we hit problems with a dotnet tool missing the right shared framework, there was some pushback about making the rollforward option more discoverable but I still think this is the better "just works" option for a majority of the cases: dotnet/runtime#61019 |
@akoeplinger I think the problem with global tools should not be solved in the host - host is for all apps, lot of the above problems are relatively specific to global tools. Also things like roll-forward are very focused on developers, the host needs to target "normal users" - so anything more complicated than "Please visit this URL" is probably too much (and yes, the current experience is unfortunately already too much). I think the core of the problem is that
I personally don't know much about the I think the solution to this would start by having a clear declaration of the requirements for a given tool and the Basically |
dotnet tool install
doesn't understand multi-arch systems or TFM requirements
+100. This is a CLI issue. That all said. There is a simple workaround. Multi-target. That's what the EFCore folks did: dotnet/efcore#27807. In the ideal experience,
Apps from Microsoft don't need any of that, however. They should multi-target, as efcore did. Also, we improved the error messages including https://devblogs.microsoft.com/dotnet/dotnet-apphost-improvements/ |
Also, should we start with better guidance on this scenario? I'm about to update our guidance on multi-arch systems. Should I include this scenario and suggest that the guidance I gave the efcore team (MT) is the best practice? |
I ran into this (or some subset of it) today. I think some of this is new information; I hope it's useful. I got into the situation originally with SDK 6.0.300 (6.0.5 runtime), but it's reproducible with the latest as of today—7.0.200 (7.0.3 runtime). I'm on an M1 Mac (arm64), and this was my experience: $ dotnet --info
[ see bottom of comment ]
$ dotnet tool install --global coverlet.console
Skipping NuGet package signature verification.
You can invoke the tool using the following command: coverlet
Tool 'coverlet.console' (version '3.2.0') was successfully installed.
$ coverlet -h
You must install .NET to run this application.
App: /Users/duvall/.dotnet/tools/coverlet
Architecture: x64
App host version: 7.0.3
.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=7.0.3 The instructions at the It took me a while to notice the What I didn't see mentioned in the discussion above was the $ dotnet tool uninstall --global coverlet.console
Tool 'coverlet.console' (version '3.2.0') was successfully uninstalled.
$ dotnet tool install --global --arch arm64 coverlet.console
Skipping NuGet package signature verification.
You can invoke the tool using the following command: coverlet
Tool 'coverlet.console' (version '3.2.0') was successfully installed.
$ coverlet -h
Cross platform .NET Core code coverage tool 3.2.0.0
Usage: coverlet [options] <<ASSEMBLY|DIRECTORY>>
[ ... ] The original discussion here is from some time ago, and I'm sure things have changed a bit since then, but it seems like much of the discussion has been about whether the tool is available at all for ARM64. But that certainly doesn't seem to be my problem. Instead, it looks like even when there is a choice, the installer makes the wrong one.
|
Added this one to the list of things for the SDK team to tackle for the .NET 8 cycle. |
Thanks @dhduvall, just been experiencing exactly the same issue on M1 with it trying |
A user of the .NET global tool vsmac-cli reported the following host error when trying to use the tool after installing it.
This error occurred because the app is framework dependent and the end user does not have the required framework installed. This is likely a common scenario for end users, yet the message is needlessly complex, with implementation details (libhostfxr) and irrelevant information (self-contained vs shared) that appears to be targeted at the developer of the app. This provided URL also appears to be incorrect, as the app's manifest does not allow it to be run with 6.x.
I would suggest that the error be more specifically targeted at helping end users understand the problem and resolve it e.g. something like
Perhaps
dotnet-tool
could also detect the missing runtime and prompt users to install it upfront when installing the tool.The text was updated successfully, but these errors were encountered: