-
Notifications
You must be signed in to change notification settings - Fork 585
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
Platform not supported exception if using PowerShell Import-Module #863
Comments
We would need more info in order to investigate this (like callstack, or the way you published the app), have you tried breaking this up in a debugger? The reason why I believe this is happening is because we have 3 different implementations for the library, one is for windows, one is for linux, and the other one is platform-agnostic which just throws platform not supported exception. I believe the problem here is that when you call the program via dotnet, the runtime loader knows how to read the json config files with the app, and will know how to pick the right version of System.Device.Gpio (in this case it should pick the windows implementation) but when you load it via powershell, powershell doesn't know how to read that runtime json file, so it just picks the platform agnostic which throws. In order to validate this, can you please try again, EDIT: I figured out later that you were actually not running in windows so my next comment has the right publish command to use. |
sorry just noticed that you are actually running on a raspberry pi, not in Windows, so what you want for a publish command is this: |
Closing as the issue seems to be resolved. |
I have a C# DLL that has the
System.Device.Gpio Version="1.0.0"
and I want to use it with PowerShell, through Import-Module. Upon importing the DLL, if I try to create an I2cConnectSettings object, I get an exception saying thatOperation is not supported on this platform
.On the same project, I've created the Main method that does exactly the same. If I run
dotnet donetIot_test.dll
the code runs successfully.I can't seem to find the root cause of the exception, but the platform is the same (raspberry pi 3b) - assuming that the platform is the hardware.
If I run the
dotnet donetIot_test.dll
command inside PowerShell it works, so it doesn't seem to be shell-related.Here's a link to the repo with a sample
Versions used
Add following information:
dotnet --info on the machine being used to build
.NET Core SDK (reflecting any global.json): Version: 3.0.100 Commit: 04339c3a26Runtime Environment:
OS Name: Mac OS X
OS Version: 10.13
OS Platform: Darwin
RID: osx.10.13-x64
Base Path: /usr/local/share/dotnet/sdk/3.0.100/
Host (useful for support):
Version: 3.0.0
Commit: 7d57652f33
.NET Core SDKs installed:
2.1.202 [/usr/local/share/dotnet/sdk]
2.1.700 [/usr/local/share/dotnet/sdk]
2.2.107 [/usr/local/share/dotnet/sdk]
3.0.100 [/usr/local/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.2.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.0.9 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
dotnet --info on the machine where app is being run (not applicable for self-contained apps)
pi@raspberrypi:~/PowerShell_IoT/publish $ dotnet --info It was not possible to find any installed .NET Core SDKs Did you mean to run .NET Core SDK commands? Install a .NET Core SDK from: https://aka.ms/dotnet-downloadHost (useful for support):
Version: 3.0.0
Commit: 7d57652f33
.NET Core SDKs installed:
No SDKs were found.
.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.0.0 [/home/pi/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.0.0 [/home/pi/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
System.Device.Gpio
package: 1.0.0The text was updated successfully, but these errors were encountered: