OpenMacroBoard / StreamDeckSharp

A simple .NET wrapper for Stream Deck
MIT License
351 stars 47 forks source link

Want to mention on the README that it can work on macOS? #34

Closed g3rv4 closed 2 years ago

g3rv4 commented 3 years ago

Hi there :)

I was playing with the library... and I was able to make it run on macOS by installing runtime.osx.10.10-x64.CoreCompat.System.Drawing from NuGet.

Would it make sense to add this bit to the README? it could be with a disclaimer that you can't support it, but could be useful for people that still want to try it out.

It's not exactly what I was after but wow, this is a nice library! kudos!

chriskooken commented 2 years ago

@g3rv4 Are you using this on Xamarin.Mac or regular dotnetcore on mac? I am trying to get it working on Xamarin.Mac and I'm getting platform not supported. Any workarounds you know of?

g3rv4 commented 2 years ago

just regular dotnet :)

chriskooken commented 2 years ago

@g3rv4 It looks like the error I'm getting is related to System.Drawing as well. I installed the CoreCompat above. Just wondering if you had any ideas/thoughts on this:

Its erroring on System.Drawing.Imaging.ImageCodecInfo.GetImageDecoders ()

System.TypeInitializationException: The type initializer for 'StreamDeckSharp.Hardware' threw an exception. ---> System.PlatformNotSupportedException: Operation is not supported on this platform.
  at System.Drawing.Imaging.ImageCodecInfo.GetImageDecoders () [0x00000] in <ff7780da23244c8b8f75529571e2e4bc>:0 
  at StreamDeckSharp.Internals.StreamDeckJpgHardwareBase..ctor (OpenMacroBoard.SDK.GridKeyPositionCollection keyPositions) [0x00006] in D:\Code\bitOxide\OpenMacroBoard.MetaProject\src\StreamDeckSharp\src\StreamDeckSharp\Internals\StreamDeckJpgHardwareBase.cs:25 
  at StreamDeckSharp.Internals.StreamDeckRev2HardwareInfo..ctor () [0x00000] in D:\Code\bitOxide\OpenMacroBoard.MetaProject\src\StreamDeckSharp\src\StreamDeckSharp\Internals\StreamDeckRev2HardwareInfo.cs:10 
  at StreamDeckSharp.Hardware..cctor () [0x0000a] in D:\Code\bitOxide\OpenMacroBoard.MetaProject\src\StreamDeckSharp\src\StreamDeckSharp\Hardware.cs:38 
   --- End of inner exception stack trace ---
  at StreamDeckSharp.Internals.HidDeviceExtensions.GetDeviceDetails (System.Int32 vendorId, System.Int32 productId) [0x00033] in D:\Code\bitOxide\OpenMacroBoard.MetaProject\src\StreamDeckSharp\src\StreamDeckSharp\Internals\HidDeviceExtensions.cs:22 
  at StreamDeckSharp.Internals.HidDeviceExtensions.GetHardwareInformation (HidSharp.HidDevice hid) [0x00000] in D:\Code\bitOxide\OpenMacroBoard.MetaProject\src\StreamDeckSharp\src\StreamDeckSharp\Internals\HidDeviceExtensions.cs:9 
  at StreamDeckSharp.Internals.DeviceListExtensions+<>c__DisplayClass0_0.<GetStreamDecks>g__MatchingHardware|0 (HidSharp.HidDevice d) [0x00000] in D:\Code\bitOxide\OpenMacroBoard.MetaProject\src\StreamDeckSharp\src\StreamDeckSharp\Internals\DeviceListExtensions.cs:21 
  at StreamDeckSharp.Internals.DeviceListExtensions+<>c__DisplayClass0_0.<GetStreamDecks>b__1 (HidSharp.HidDevice device) [0x00000] in D:\Code\bitOxide\OpenMacroBoard.MetaProject\src\StreamDeckSharp\src\StreamDeckSharp\Internals\DeviceListExtensions.cs:47 
  at System.Linq.Enumerable+SelectEnumerableIterator`2[TSource,TResult].MoveNext () [0x00036] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/external/corefx/src/System.Linq/src/System/Linq/Select.cs:131 
  at System.Linq.Enumerable+WhereSelectEnumerableIterator`2[TSource,TResult].MoveNext () [0x00059] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/external/corefx/src/System.Linq/src/System/Linq/Where.cs:696 
  at System.Linq.Enumerable.TryGetFirst[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Boolean& found) [0x00045] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/external/corefx/src/System.Linq/src/System/Linq/First.cs:63 
  at System.Linq.Enumerable.FirstOrDefault[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/external/corefx/src/System.Linq/src/System/Linq/First.cs:34 
  at StreamDeckSharp.StreamDeck.OpenDevice (StreamDeckSharp.IUsbHidHardware[] hardware) [0x00000] in D:\Code\bitOxide\OpenMacroBoard.MetaProject\src\StreamDeckSharp\src\StreamDeckSharp\StreamDeck.cs:37 
  at SonyPTZ.ViewController.ViewDidLoad () [0x00271] in /Users/chris/projects/SonyPTZ/SonyPTZ/ViewController.cs:60 
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1021 
  at Foundation.NSAsyncSynchronizationContextDispatcher.Apply () [0x00002] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSAction.cs:178 
  at (wrapper managed-to-native) AppKit.NSApplication.NSApplicationMain(int,string[])
  at AppKit.NSApplication.Main (System.String[] args) [0x00040] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/AppKit/NSApplication.cs:109 
  at SonyPTZ.MainClass.Main (System.String[] args) [0x00007] in /Users/chris/projects/SonyPTZ/SonyPTZ/Main.cs:7 
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for 'StreamDeckSharp.Hardware' threw an exception. ---> System.PlatformNotSupportedException: Operation is not supported on this platform.
  at System.Drawing.Imaging.ImageCodecInfo.GetImageDecoders () [0x00000] in <ff7780da23244c8b8f75529571e2e4bc>:0 
  at StreamDeckSharp.Internals.StreamDeckJpgHardwareBase..ctor (OpenMacroBoard.SDK.GridKeyPositionCollection keyPositions) [0x00006] in D:\Code\bitOxide\OpenMacroBoard.MetaProject\src\StreamDeckSharp\src\StreamDeckSharp\Internals\StreamDeckJpgHardwareBase.cs:25 
  at StreamDeckSharp.Internals.StreamDeckRev2HardwareInfo..ctor () [0x00000] in D:\Code\bitOxide\OpenMacroBoard.MetaProject\src\StreamDeckSharp\src\StreamDeckSharp\Internals\StreamDeckRev2HardwareInfo.cs:10 
  at StreamDeckSharp.Hardware..cctor () [0x0000a] in D:\Code\bitOxide\OpenMacroBoard.MetaProject\src\StreamDeckSharp\src\StreamDeckSharp\Hardware.cs:38 
   --- End of inner exception stack trace ---
  at StreamDeckSharp.Internals.HidDeviceExtensions.GetDeviceDetails (System.Int32 vendorId, System.Int32 productId) [0x00033] in D:\Code\bitOxide\OpenMacroBoard.MetaProject\src\StreamDeckSharp\src\StreamDeckSharp\Internals\HidDeviceExtensions.cs:22 
  at StreamDeckSharp.Internals.HidDeviceExtensions.GetHardwareInformation (HidSharp.HidDevice hid) [0x00000] in D:\Code\bitOxide\OpenMacroBoard.MetaProject\src\StreamDeckSharp\src\StreamDeckSharp\Internals\HidDeviceExtensions.cs:9 
  at StreamDeckSharp.Internals.DeviceListExtensions+<>c__DisplayClass0_0.<GetStreamDecks>g__MatchingHardware|0 (HidSharp.HidDevice d) [0x00000] in D:\Code\bitOxide\OpenMacroBoard.MetaProject\src\StreamDeckSharp\src\StreamDeckSharp\Internals\DeviceListExtensions.cs:21 
  at StreamDeckSharp.Internals.DeviceListExtensions+<>c__DisplayClass0_0.<GetStreamDecks>b__1 (HidSharp.HidDevice device) [0x00000] in D:\Code\bitOxide\OpenMacroBoard.MetaProject\src\StreamDeckSharp\src\StreamDeckSharp\Internals\DeviceListExtensions.cs:47 
  at System.Linq.Enumerable+SelectEnumerableIterator`2[TSource,TResult].MoveNext () [0x00036] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/external/corefx/src/System.Linq/src/System/Linq/Select.cs:131 
  at System.Linq.Enumerable+WhereSelectEnumerableIterator`2[TSource,TResult].MoveNext () [0x00059] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/external/corefx/src/System.Linq/src/System/Linq/Where.cs:696 
  at System.Linq.Enumerable.TryGetFirst[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Boolean& found) [0x00045] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/external/corefx/src/System.Linq/src/System/Linq/First.cs:63 
  at System.Linq.Enumerable.FirstOrDefault[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/external/corefx/src/System.Linq/src/System/Linq/First.cs:34 
  at StreamDeckSharp.StreamDeck.OpenDevice (StreamDeckSharp.IUsbHidHardware[] hardware) [0x00000] in D:\Code\bitOxide\OpenMacroBoard.MetaProject\src\StreamDeckSharp\src\StreamDeckSharp\StreamDeck.cs:37 
  at SonyPTZ.ViewController.ViewDidLoad () [0x00271] in /Users/chris/projects/SonyPTZ/SonyPTZ/ViewController.cs:60 
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) [0x00000] in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/src/Xamarin.Mac/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1021 
  at Foundation.NSAsyncSynchronizationContextDispatcher.Apply () [0x00002] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSAction.cs:178 
  at (wrapper managed-to-native) AppKit.NSApplication.NSApplicationMain(int,string[])
  at AppKit.NSApplication.Main (System.String[] args) [0x00040] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/AppKit/NSApplication.cs:109 
  at SonyPTZ.MainClass.Main (System.String[] args) [0x00007] in /Users/chris/projects/SonyPTZ/SonyPTZ/Main.cs:7 
g3rv4 commented 2 years ago

I don't... as you can see from my original message, I was playing with this a long time ago and it didn't even meet my needs

wischi-chr commented 2 years ago

@chriskooken The stack trace looks like that the JPEG encoder from System.Drawing is not working on macOS. Because I don't have a mac I can't really fix/test that, but if you find a .net jpeg encoder that works on mac it should be fixable.

Update: Can you take a look at that: https://github.com/OpenMacroBoard/StreamDeckSharp/pull/33/files @Suplanus suggests that adding libgdiplus packaging should work

chriskooken commented 2 years ago

Yea. I added the libgdiplus stuff to MY project to no avail...but I am going to try checking out all of your code and adding it there to see if that fixes it.

wischi-chr commented 2 years ago

I just created a wiki article to document how one might get it to run on macOS and added a link to that wiki page to the README.md. Because this issue was originally about the README I'm closing this issue now - @chriskooken if you still have problems feel free to open another issue.