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

Shared framework is missing correct RID fallback chain for manjaro #62554

Closed
badgerwild opened this issue Nov 25, 2021 · 45 comments
Closed

Shared framework is missing correct RID fallback chain for manjaro #62554

badgerwild opened this issue Nov 25, 2021 · 45 comments
Milestone

Comments

@badgerwild
Copy link

Describe the bug

A embedded systems project that I am working on uses a C# program as a serial loader to send data to an Arduino Nano. I have installed dotnet and adding the System.Io.Ports package on the host machine. When trying to run the project, I get an error saying that System.Io.Ports is only available on windows. This same code and installation process works on Ubuntu 18.04, the latest version of Arch Linux, and Mac without issue.

To Reproduce

Exceptions (if any)

Unhandled exception. System.PlatformNotSupportedException: System.IO.Ports is currently only supported on Windows.
   at System.IO.Ports.SerialPort..ctor()
   at SerialComPort.Main(String[] args) in /home/jason/collective/soen-422/SOEN422-PROJ/vm/task5/Lecture8_SerialLoader.cs:line 121

Further technical details

Project is built and run through the CLI using the command sudo dotnet run <file>
dotnet --info on the Manjaro system

.NET SDK (reflecting any global.json):
 Version:   6.0.100
 Commit:    9e8b04bbff

Runtime Environment:
 OS Name:     manjaro
 OS Version:  
 OS Platform: Linux
 RID:         arch-x64
 Base Path:   /usr/share/dotnet/sdk/6.0.100/

Host (useful for support):
  Version: 6.0.0
  Commit:  4822e3c3aa

.NET SDKs installed:
  6.0.100 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

output of dotnet list package :

Project 'csloader' has the following package references
   [net6.0]: 
   Top-level Package      Requested   Resolved
   > System.IO.Ports      6.0.0       6.0.0   

Here is dotnet --info on the Arch and Ubuntu systems where the System.Io.Serial does work on this project:

.NET SDK (reflecting any global.json):
 Version:   6.0.100
 Commit:    9e8b04bbff

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  18.04
 OS Platform: Linux
 RID:         ubuntu.18.04-x64
 Base Path:   /snap/dotnet-sdk/147/sdk/6.0.100/

Host (useful for support):
  Version: 6.0.0
  Commit:  4822e3c3aa

.NET SDKs installed:
  6.0.100 [/snap/dotnet-sdk/147/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.0 [/snap/dotnet-sdk/147/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.0 [/snap/dotnet-sdk/147/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download
❯ dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.100
 Commit:    9e8b04bbff

Runtime Environment:
 OS Name:     arch
 OS Version:  
 OS Platform: Linux
 RID:         arch-x64
 Base Path:   /usr/share/dotnet/sdk/6.0.100/

Host (useful for support):
  Version: 6.0.0
  Commit:  4822e3c3aa

.NET SDKs installed:
  6.0.100 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download
@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@badgerwild badgerwild changed the title System.Io.Serial Appears Broken on Manjaro System.Io.Ports Appears Broken on Manjaro Nov 26, 2021
@dsplaisted dsplaisted transferred this issue from dotnet/sdk Dec 8, 2021
@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Dec 8, 2021
@dsplaisted dsplaisted removed their assignment Dec 8, 2021
@ghost
Copy link

ghost commented Dec 8, 2021

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

Issue Details

Describe the bug

A embedded systems project that I am working on uses a C# program as a serial loader to send data to an Arduino Nano. I have installed dotnet and adding the System.Io.Ports package on the host machine. When trying to run the project, I get an error saying that System.Io.Ports is only available on windows. This same code and installation process works on Ubuntu 18.04, the latest version of Arch Linux, and Mac without issue.

To Reproduce

Exceptions (if any)

Unhandled exception. System.PlatformNotSupportedException: System.IO.Ports is currently only supported on Windows.
   at System.IO.Ports.SerialPort..ctor()
   at SerialComPort.Main(String[] args) in /home/jason/collective/soen-422/SOEN422-PROJ/vm/task5/Lecture8_SerialLoader.cs:line 121

Further technical details

Project is built and run through the CLI using the command sudo dotnet run <file>
dotnet --info on the Manjaro system

.NET SDK (reflecting any global.json):
 Version:   6.0.100
 Commit:    9e8b04bbff

Runtime Environment:
 OS Name:     manjaro
 OS Version:  
 OS Platform: Linux
 RID:         arch-x64
 Base Path:   /usr/share/dotnet/sdk/6.0.100/

Host (useful for support):
  Version: 6.0.0
  Commit:  4822e3c3aa

.NET SDKs installed:
  6.0.100 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

output of dotnet list package :

Project 'csloader' has the following package references
   [net6.0]: 
   Top-level Package      Requested   Resolved
   > System.IO.Ports      6.0.0       6.0.0   

Here is dotnet --info on the Arch and Ubuntu systems where the System.Io.Serial does work on this project:

.NET SDK (reflecting any global.json):
 Version:   6.0.100
 Commit:    9e8b04bbff

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  18.04
 OS Platform: Linux
 RID:         ubuntu.18.04-x64
 Base Path:   /snap/dotnet-sdk/147/sdk/6.0.100/

Host (useful for support):
  Version: 6.0.0
  Commit:  4822e3c3aa

.NET SDKs installed:
  6.0.100 [/snap/dotnet-sdk/147/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.0 [/snap/dotnet-sdk/147/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.0 [/snap/dotnet-sdk/147/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download
❯ dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.100
 Commit:    9e8b04bbff

Runtime Environment:
 OS Name:     arch
 OS Version:  
 OS Platform: Linux
 RID:         arch-x64
 Base Path:   /usr/share/dotnet/sdk/6.0.100/

Host (useful for support):
  Version: 6.0.0
  Commit:  4822e3c3aa

.NET SDKs installed:
  6.0.100 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download
Author: badgerwild
Assignees: -
Labels:

area-System.IO, untriaged

Milestone: -

@ericstj
Copy link
Member

ericstj commented Dec 8, 2021

 RID:         arch-x64

This should load net6.0-unix implementation in the runtimes/unix/lib/net6.0 folder per 00d8f8e#diff-896c6652ae24cab2b91d7d5ab1696fced448d15514a344b7ea9d08552275d817R286

But instead is loading the platform-agnostic implementation (net6.0), which (BUG) should update its resource string. It could be caused by how your referencing the Ports (make sure to use the package) or loading it (make sure its listed in your project's deps file).

Can you run just the output of the project, with host tracing enabled? That should indicate which RID the host is using and what assemblies it's considering when you load System.IO.Ports.dll.

@ericstj
Copy link
Member

ericstj commented Dec 9, 2021

@ericstj ericstj added the needs-author-action An issue or pull request that requires more info or actions from the author. label Dec 9, 2021
@PRIMETSS
Copy link
Contributor

PRIMETSS commented Dec 14, 2021

@ghost ghost added the no-recent-activity label Jan 19, 2022
@ghost
Copy link

ghost commented Jan 19, 2022

This issue has been automatically marked no recent activity because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will remove no recent activity.

@keithblows
Copy link

Arch and Alpine Linux variants/derivatives raise this exception with .NET 6.0.1

@ghost ghost removed the no-recent-activity label Jan 19, 2022
@Joelius300
Copy link

Joelius300 commented Jan 27, 2022

Any updates on this? I couldn't find any workarounds so as of now I can't work on my application because of this targeting bug. It would be great to have a fix, even if it's just a temporary one.

I searched through the sources and found some msbuild (I think) entries and copied them to my code to see what variables are set. However, I have never worked with msbuild directly and I'm not sure if I understand; please correct me if I'm wrong.

The following .csproj builds correctly on my 5.16.2-1-MANJARO which would indicate that

  • it's not a partial facade assembly
  • I don't target any OS (?)
  • I don't target windows
  • I don't target Unix (?)

If any of those conditions weren't true, the build would throw an error indicating that that file could not be found.

<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>net6.0</TargetFramework>
        <ImplicitUsings>enable</ImplicitUsings>
        <Nullable>enable</Nullable>
    </PropertyGroup>

    <ItemGroup>
      <PackageReference Include="System.IO.Ports" Version="6.0.0" />
    </ItemGroup>
    
    <PropertyGroup>
      <IsPartialFacadeAssembly Condition="$([MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)')) == '.NETFramework'">true</IsPartialFacadeAssembly>
    </PropertyGroup>
  
    <ItemGroup>
      <Compile Condition="'$(IsPartialFacadeAssembly)' == 'true'" Include="PartialFacadeAssembly == true" />
      <Compile Condition="'$(TargetsAnyOS)' == 'true'" Include="TargetsAnyOS == true" />
      <Compile Condition="'$(TargetsWindows)' == 'true'" Include="TargetsWindows == true" />
      <Compile Condition="'$(TargetsUnix)' == 'true'" Include="TargetsUnix == true" />
    </ItemGroup>
</Project>

In the following snippet there's a condition for generating the not-supported warnings with "ISN'T a partial facade assembly AND DOES target any OS". I don't know when these conditions are checked. If they are checked when I build my project, I don't understand why these warnings are generated, since only the first of those two conditions apply to my project.

<GeneratePlatformNotSupportedAssemblyMessage Condition="'$(IsPartialFacadeAssembly)' != 'true' and '$(TargetsAnyOS)' == 'true'">SR.PlatformNotSupported_IOPorts</GeneratePlatformNotSupportedAssemblyMessage>

Also more of a side-note but "System.IO.Ports is currently only supported on Windows." hasn't been true for quite a while now.

<value>System.IO.Ports is currently only supported on Windows.</value>

@Joelius300
Copy link

Arch and Alpine Linux variants/derivatives raise this exception with .NET 6.0.1

According to https://github.com/dotnet/core/blob/main/release-notes/6.0/supported-os.md#linux, Alpine Linux should be fully supported, so that's even worse than the Manjaro case I guess.

I also just now for the first time realized that .NET doesn't support Arch Linux derivatives. That's very unfortunate, I've been using it on Manjaro (arch based) for a while now without issues until this struck. I really hope .NET can support Arch distros in the future!

@Joelius300
Copy link

Any updates on this? Or any workarounds?

@ghost ghost added the no-recent-activity label Feb 22, 2022
@ghost
Copy link

ghost commented Feb 22, 2022

This issue has been automatically marked no-recent-activity because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will remove no-recent-activity.

@Joelius300
Copy link

Bump

@ghost ghost removed the no-recent-activity label Feb 22, 2022
@PRIMETSS
Copy link
Contributor

PRIMETSS commented Mar 3, 2022

Arch Linux

OK I just downloaded latest version of Manjaro 21.2.4 and created a USB boot version (just for quick test on laptop)
Installed latest version of dotnet SDK 6.0.102 with installer dotnet-installer.sh
dotnet-install.sh
Built this simple Serial Test utility I wrote years ago for testing ports on Pi's
Repo GITHUB
Added package reference to .csproj file to latest preview (removed the that was pulling System.IO.Ports from local dotnet Repo I was previously working on System.IO.Ports/SerialPorts, fixed version to the preview)

<ItemGroup> <PackageReference Include="System.IO.Ports" Version="7.0.0-preview.1.22076.8" /> </ItemGroup>
Did a dotnet restore and rebuild to pull down package reference
Connected a USB FTDI Serial port/device
And ran the Test app, and it found the serial port and opened it.
Was expecting a failure or not found. But seems to work.
I haven't tried it older v5 SDK of dotnet
Screenshot_2022-03-03_04-39-52

So have you tried the latest build and latest preview of System.IO.Ports ?

@Joelius300
Copy link

Joelius300 commented Mar 3, 2022

Unfortunately that doesn't work for me.

dotnet --info (I didn't use the installer script because I've never encountered issues with the official repo version unlike others)

.NET SDK (reflecting any global.json):
 Version:   6.0.102
 Commit:    49861cb924

Runtime Environment:
 OS Name:     manjaro
 OS Version:  
 OS Platform: Linux
 RID:         arch-x64
 Base Path:   /usr/share/dotnet/sdk/6.0.102/

Host (useful for support):
  Version: 6.0.2
  Commit:  839cdfb0ec

.NET SDKs installed:
  3.1.120 [/usr/share/dotnet/sdk]
  6.0.102 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.20 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.2 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

My os is:

5.16.11-2-MANJARO x86_64 GNU/Linux

csproj of test-project:

<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>net6.0</TargetFramework>
        <ImplicitUsings>enable</ImplicitUsings>
        <Nullable>enable</Nullable>
    </PropertyGroup>

    <ItemGroup>
      <PackageReference Include="System.IO.Ports" Version="7.0.0-preview.1.22076.8" />
    </ItemGroup>

</Project>

I still get the same exception as soon as the constructor is called (after clearing all NuGet caches):

System.PlatformNotSupportedException: System.IO.Ports is currently only supported on Windows.
   at System.IO.Ports.SerialPort..ctor()
   at Program.<Main>$(String[] args) in .../Program.cs:line 20
   at Program.<Main>(String[] args)

Ps. your repo is probably private, I can't view it.

@PRIMETSS
Copy link
Contributor

PRIMETSS commented Mar 3, 2022

5.16.11-2-MANJARO x86_64 GNU/Linux ? I can find that version, but might be just be a different reported version format.
What's it running on?

@Joelius300
Copy link

@PRIMETSS

I just did uname -srmo to get Linux 5.16.11-2-MANJARO x86_64 GNU/Linux. 5.16.11-2 is just my linux kernel version. My Manjaro is fully updated so if you did that after installing, you should have the same system package wise.

Again, the more interesting difference might be how .NET was installed. Could you try installing .NET SDK 6.0.2 from the package manager and see if that works?

What's it running on?

Not sure what you mean. It's bare-metal, not a VM, if that's what you mean.

@PRIMETSS
Copy link
Contributor

PRIMETSS commented Mar 3, 2022

@Joelius300 Didn't want to make that repo public as it's just a very simple junk hack test util. But Ive added you as contributor so you can try it so comparing like for like.
Is there a way to contact you out of band so we don't spam this topic unless worth while to share. (add note to repo)
Interesting to find out why I didn't have issue today from a new install. (as above)
Did a uname and was 'Linux 5.15.25-1-MANJARO x86_64 GNU/Linux' Interesting older Kernel than yours.. (Was stable branch though)

@ghost ghost removed the no-recent-activity label Apr 17, 2022
@ghost ghost added the no-recent-activity label May 1, 2022
@ghost
Copy link

ghost commented May 1, 2022

This issue has been automatically marked no-recent-activity because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will remove no-recent-activity.

@Joelius300
Copy link

Bump

@ghost ghost removed the no-recent-activity label May 2, 2022
@danmoseley
Copy link
Member

danmoseley commented May 2, 2022

@ericstj do you have any further thoughts re above?

@ericstj
Copy link
Member

ericstj commented May 2, 2022

@Joelius300 sorry for the delay in getting back to you. Let me just restate what I'm seeing where I think things are going wrong.

  1. FAILING: https://gist.github.com/Joelius300/71d5b26c6cd2999b73d3ff6c908f8c4b
HostRID is manjaro-x64
Falling back to base HostRID: linux-x64
The targeted framework does not support the runtime 'linux-x64'. Some native libraries from [System.IO.Ports/6.0.0] may fail to load on this platform.
  1. Succeeding: https://gist.github.com/Joelius300/e931369c0763f6adc7f4302687f1b9a2
HostRID is manjaro-x64
Falling back to base HostRID: linux-x64
Chose unix, so removing rid (win) specific assets for package System.IO.Ports/6.0.0 and asset type runtime

If you examine the fallback-RID chain's present in the success case, you'll see that a chain is defined for linux-x64 that begins with linux-x64 =>.

In the case of the failing runtime, the shared frameworks deps file does not have this fallback chain. The only one present is for arch-64 Since this chains neither starts with the actual RID (manjaro-x64) nor the fallback rid (linux-x64) the host will not use it. @vitek-karas does this sound correct?

If you would like for that failing case to better support falling back to the linux-x64 RID then you should make sure it has that fallback chain added to the shared framework's deps file. I think this is controlled by the flag @jkoritzinsky added here: dotnet/arcade@d4dc368
Any idea how those official manjaro packages are building and how to make such a change?

@ericstj ericstj changed the title System.Io.Ports Appears Broken on Manjaro Shared framework is missing correct RID fallback chain for manjaro May 2, 2022
@ghost
Copy link

ghost commented May 2, 2022

Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov
See info in area-owners.md if you want to be subscribed.

Issue Details

Describe the bug

A embedded systems project that I am working on uses a C# program as a serial loader to send data to an Arduino Nano. I have installed dotnet and adding the System.Io.Ports package on the host machine. When trying to run the project, I get an error saying that System.Io.Ports is only available on windows. This same code and installation process works on Ubuntu 18.04, the latest version of Arch Linux, and Mac without issue.

To Reproduce

Exceptions (if any)

Unhandled exception. System.PlatformNotSupportedException: System.IO.Ports is currently only supported on Windows.
   at System.IO.Ports.SerialPort..ctor()
   at SerialComPort.Main(String[] args) in /home/jason/collective/soen-422/SOEN422-PROJ/vm/task5/Lecture8_SerialLoader.cs:line 121

Further technical details

Project is built and run through the CLI using the command sudo dotnet run <file>
dotnet --info on the Manjaro system

.NET SDK (reflecting any global.json):
 Version:   6.0.100
 Commit:    9e8b04bbff

Runtime Environment:
 OS Name:     manjaro
 OS Version:  
 OS Platform: Linux
 RID:         arch-x64
 Base Path:   /usr/share/dotnet/sdk/6.0.100/

Host (useful for support):
  Version: 6.0.0
  Commit:  4822e3c3aa

.NET SDKs installed:
  6.0.100 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

output of dotnet list package :

Project 'csloader' has the following package references
   [net6.0]: 
   Top-level Package      Requested   Resolved
   > System.IO.Ports      6.0.0       6.0.0   

Here is dotnet --info on the Arch and Ubuntu systems where the System.Io.Serial does work on this project:

.NET SDK (reflecting any global.json):
 Version:   6.0.100
 Commit:    9e8b04bbff

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  18.04
 OS Platform: Linux
 RID:         ubuntu.18.04-x64
 Base Path:   /snap/dotnet-sdk/147/sdk/6.0.100/

Host (useful for support):
  Version: 6.0.0
  Commit:  4822e3c3aa

.NET SDKs installed:
  6.0.100 [/snap/dotnet-sdk/147/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.0 [/snap/dotnet-sdk/147/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.0 [/snap/dotnet-sdk/147/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download
❯ dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.100
 Commit:    9e8b04bbff

Runtime Environment:
 OS Name:     arch
 OS Version:  
 OS Platform: Linux
 RID:         arch-x64
 Base Path:   /usr/share/dotnet/sdk/6.0.100/

Host (useful for support):
  Version: 6.0.0
  Commit:  4822e3c3aa

.NET SDKs installed:
  6.0.100 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download
Author: badgerwild
Assignees: -
Labels:

area-Host, needs-author-action

Milestone: Future

@Joelius300
Copy link

Joelius300 commented May 3, 2022

@ericstj No worries, thanks for investigating :)

Any idea how those official manjaro packages are building and how to make such a change?

No idea, I'm sorry.

If you need anything from my end, I'll be happy to assist where I can.

@vitek-karas
Copy link
Member

This feels almost like a dupe of dotnet/sdk#23390.
Basically the RID fallback graph is wrong in this case.

Short description of how the RID stuff works in the host:

  • Host loads the RID fallback graph. For framework dependent apps this comes from the Microsoft.NETCore.App.deps.json. For self-contained apps it comes from the app.deps.json. Ultimately it's produced by the SDK.
  • Host determines a very specific RID, on Linux this is typically <distroname>.<version>-<arch>. In the Manjaro case it got manjaro-x64. The code for this is rather complicated and differs a lot across platforms: (and around)
  • It tries to find this very specific RID (manjaro-x64) in the RID fallback graph. If it's there, great, it uses it.
  • If it's not there it constructs a fallback RID - this one is hardcoded in the host - it is basically <platform>-<arch>, so in this case linux-x64.
  • It then looks for this in the RID fallback graph again - if it's there, uses it.
  • If it has RID in the fallback graph it starts from the RID it found (so linux-x64 in this case) and sees if a given entry has asset for the RID, if not, it goes one step down in the graph and looks again and so on. This is how in the success case it found the unix RID and found the asset (runtimes/unix/lib/net6.0/System.IO.Ports.dll) for it.
  • If even the fallback RID is not in the graph it will not be able to fully resolve RIDs, and so it looks for exact match to the fallback RID only - this is the second failing case - since there's no asset for System.IO.Ports.dll for RID linux-x64, so in this case it adds the RID-less asset lib/net6.0/System.IO.Ports.dll which is probably just an empty shell with throws everywhere.

I think the fix for this is effectively the same as the fix for dotnet/sdk#23390 - that is to never get a RID fallback graph which is incomplete. The arch-x64 fallback graph in the failing case is incomplete because it defines fallbacks for arch-x64, but not fallbacks of those fallbacks. Essentially each fallback graph should have a path from any RID through any of its fallbacks all the way down to any/base RID. This one doesn't.

@ericstj
Copy link
Member

ericstj commented May 17, 2022

It could be that #53550 helps here.

@ghost ghost added the no-recent-activity label Jun 1, 2022
@ghost
Copy link

ghost commented Jun 1, 2022

This issue has been automatically marked no-recent-activity because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will remove no-recent-activity.

@Joelius300
Copy link

Bump :)

@ghost ghost removed the no-recent-activity label Jun 7, 2022
@agocke agocke added this to AppModel Jun 14, 2022
@agocke
Copy link
Member

agocke commented Jun 14, 2022

We don't plan to make any changes for this area for .NET 7. For .NET 8, we're investigating #59803, which may address this scenario directly, or cause us to take a different change for this.

In the meantime I see two potential solutions:

  1. Use the Microsoft-provided zip files for portable linux-x64 (i.e. from https://dot.net/download)
  2. Contact the maintainer of the dotnet package for the distro and have them manually fix up the runtime.json file to contain all the appropriate fallbacks

@agocke agocke modified the milestones: Future, 8.0.0 Jun 14, 2022
@agocke agocke removed the needs-author-action An issue or pull request that requires more info or actions from the author. label Jun 14, 2022
@Joelius300
Copy link

Joelius300 commented Jun 16, 2022

Thank you for the clarification.

For any Manjaro users stumbling into this issue, a third solution is using the AUR packages (e.g. dotnet-sdk-bin and aspnet-targeting-pack-bin) instead of the official ones, as those seem to work perfectly fine.

@kleisauke
Copy link

FWIW, this also causes issues with other NuGet packages distributed in a multi-target manner, see e.g. kleisauke/net-vips#186.

The symptoms are the same, it causes to reference lib/<TargetFramework>/*.dll (which are usually specific to Windows) instead of runtimes/unix/lib/<TargetFramework>/*.dll or runtimes/linux/lib/<TargetFramework>/*.dll.

@agocke
Copy link
Member

agocke commented Jun 26, 2023

Closing as RIDs are no longer resolved in the same way: https://learn.microsoft.com/en-us/dotnet/core/compatibility/deployment/8.0/rid-asset-list

@agocke agocke closed this as completed Jun 26, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Jul 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Archived in project
Development

No branches or pull requests