question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Platform not supported exception if using PowerShell Import-Module

See original GitHub issue

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 that Operation 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: 04339c3a26

Runtime 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-download

Host (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

  • Version of System.Device.Gpio package: 1.0.0

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
DanielSSilvacommented, Nov 22, 2019

Yes! That was exactly the problem! Since I saw the runtimes inside the publish folder, I didn’t even try to compile with the Linux as runtime. image

0reactions
joperezrcommented, Nov 22, 2019

Closing as the issue seems to be resolved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Powershell Function App fails to import module
The function app now fails when loading the Powershell Module (MSOnline) using the Import-Module cmdlet, like this:.
Read more >
powershell failing to import module
I am working with powershell on a server and want to use it to stop and start a task in the task scheduler....
Read more >
Solved: "Operation is not supported" error
I never though of trying to load the ONTAP toolkit even though I don't have access to any NetApp servers. On Server 2008...
Read more >
Powershell Get-AppxPackage not working
If you want to load this module into PowerShell please use 'Import-Module -SkipEditionCheck' syntax. # Get-AppxPackage -AllUsers | Select Name, ...
Read more >
Installing the AWS Tools for PowerShell on Windows
A Windows-based computer can run any of the AWS Tools for PowerShell package options:
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found