sharpdx / SharpDX

SharpDX GitHub Repository
http://sharpdx.org
MIT License
1.7k stars 638 forks source link

[MediaFoundation] Cannot create a ByteStream without referencing the WinRT Runtime #844

Closed jkoritzinsky closed 6 years ago

jkoritzinsky commented 7 years ago

Since the ByteStream class has multiple one-parameter constructors, one of which takes a IRandomAccessStream. As a result, to use any of them (including a System.IO.Stream instance) you have to reference the WinRT Runtime (which you cannot do from a portable library as far as I can tell) so the compiler can resolve the overloads and pick the right one.

xoofx commented 7 years ago

Indeed, that's a known unresolved issue. Prior to SharpDX3.0, I had to maintain a ton of platform small discrepancies and it was a pain to maintain (diff between desktop vs phone vs store), so everything was simplified to a desktop and store config, where the store is actually using portable libraries to compile, but are not actually truly "portable" as you noticed. For now, I don't have any other solutions to propose than to build your own private build and customize at your requirements.

When the new project/build csproj system will come later this year (the migration from project.json to csproj), I might migrate SharpDX to it to simplify the compilation and it could open more opportunities to build such libraries (as it will simplifies compilation to target multiple .NET framework)

That being said, I guess that you can try to add manually the reference to your portable library by editing the csproj (this is actually what is done for MediaFoundation.csproj)