mgravell / Pipelines.Sockets.Unofficial

.NET managed sockets wrapper using the new "Pipelines" API
Other
400 stars 51 forks source link

Does this project only support .Net Core, instead of .Net Framework? #51

Closed gaofeibupt closed 3 years ago

gaofeibupt commented 3 years ago

Hi, Marc

Firstly, thanks to your contributions of this project. When I used StackExchange.Redis, I found one problem. Here it is. One Property named "IsHardwareAccelerated" was not found under .Net Framework. It's in .Net Core. The problem code line https://github.com/mgravell/Pipelines.Sockets.Unofficial/blob/8cefce14b6e7c587fe72afe6435e9a07924f65b1/src/Pipelines.Sockets.Unofficial/Helpers.cs#L196 And with the document of "Vector.IsHardwareAccelerated Property" https://docs.microsoft.com/en-us/dotnet/api/system.numerics.vector.ishardwareaccelerated?view=netcore-3.1

I want to know, Does this project only support .Net Core, instead of .Net Framework? 😉

mgravell commented 3 years ago

The TFMs that it targets are clearly expressed in the nupkg, and includes net461 and net472. It should resolve the correct versions automatically. Are you seeing a problem, and if so: how are you referring the package? Do you have a package-reference?

On Thu, 16 Jul 2020, 10:05 willgor, notifications@github.com wrote:

Hi, Marc

Firstly, thanks to your contributions of this project. When I used StackExchange.Redis, I found one problem. Here it is. One Property named "IsHardwareAccelerated" was not found under .Net Framework. It's in .Net Core. The problem code line https://github.com/mgravell/Pipelines.Sockets.Unofficial/blob/8cefce14b6e7c587fe72afe6435e9a07924f65b1/src/Pipelines.Sockets.Unofficial/Helpers.cs#L196 And with the document of "Vector.IsHardwareAccelerated Property" https://docs.microsoft.com/en-us/dotnet/api/system.numerics.vector.ishardwareaccelerated?view=netcore-3.1

I want to know, Does this project only support .Net Core, instead of .Net Framework? 😉

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mgravell/Pipelines.Sockets.Unofficial/issues/51, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAEHMEP2YUIMDGOKOYH3NLR327EDANCNFSM4O33VPWQ .

gaofeibupt commented 3 years ago

I used the "build.ps1" file and the compiler was .NetCore 3.1, the target framework was .NetFramework 4.7.2. I didn't use nuget.

mgravell commented 3 years ago

And can you confirm that you saw a problem? If so, I'll try to repro. But: the build should "just work".

On Fri, 17 Jul 2020, 10:31 willgor, notifications@github.com wrote:

I used the "build.ps1" file and the compiler was .NetCore 3.1, the target framework was .NetFramework 4.7.2.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mgravell/Pipelines.Sockets.Unofficial/issues/51#issuecomment-659994586, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAEHMBFAVG4J2PQ6OVOKGLR4ALAFANCNFSM4O33VPWQ .

gaofeibupt commented 3 years ago

Yeah, the build actually works well. The property named "Vector.IsHardwareAccelerated" is only implemented in dotnet core. How does it meet the requirements of dotnet framework? I'm not familiar with dotnet eco-system.

mgravell commented 3 years ago

I suspect you mean that it wasn't available in the version that shipped alongside that .NET Framework version; however, System.Numerics.Vectors is available as an OOB package via NuGet; as long as you use the appropriate version: it is implemented. For example:

csproj:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net45</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
  </ItemGroup>
</Project>

c#:

using System;
using System.Numerics;

static class P
{
    static void Main()
    {
        Console.WriteLine(Vector.IsHardwareAccelerated);
    }
}

Which works just fine - in this case, on .NET 4.5 (chosen because that is the lowest .NET Framework version that System.Numerics.Vectors supports)

gaofeibupt commented 3 years ago

Thanks to your details guide. I tried this on my local computer, and did it successfully 🤣. The "System.Numerics" is a OOB package, a standalone distribution. I need to import this OOB package manually. I have a stupid question, does this package (System.Numerics.Vectors) released or developed by dotnet core community, instead of the dotnet framework official? 😊

mgravell commented 3 years ago

By "this package", do you mean System.Numerics.Vectors or Pipelines.Sockets.Unofficial?

System.Numerics.Vectors is entirely official / Microsoft; the OOB here just means they have shipped updates via NuGet that apply retroactively to older frameworks; the "gotcha" here is that sometimes you get "assembly binding redirect" problems as a result - you can read all about that here (including what to do if you get a problem loading types): https://nickcraver.com/blog/2020/02/11/binding-redirects/

Pipelines.Sockets.Unofficial is - as the name suggests - completely unofficial and developed purely by myself.

gaofeibupt commented 3 years ago

Got it. Thank you very much