NetFx.System.Runtime.CompilerServices.Unsafe 4.0.0

dotnet add package NetFx.System.Runtime.CompilerServices.Unsafe --version 4.0.0
NuGet\Install-Package NetFx.System.Runtime.CompilerServices.Unsafe -Version 4.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NetFx.System.Runtime.CompilerServices.Unsafe" Version="4.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NetFx.System.Runtime.CompilerServices.Unsafe --version 4.0.0
#r "nuget: NetFx.System.Runtime.CompilerServices.Unsafe, 4.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install NetFx.System.Runtime.CompilerServices.Unsafe as a Cake Addin
#addin nuget:?package=NetFx.System.Runtime.CompilerServices.Unsafe&version=4.0.0

// Install NetFx.System.Runtime.CompilerServices.Unsafe as a Cake Tool
#tool nuget:?package=NetFx.System.Runtime.CompilerServices.Unsafe&version=4.0.0

System.Runtime.CompilerServices.Unsafe Polyfill for .NET Framework 4.0

Nuget Azure DevOps builds (main) GitHub GitHub Sponsors

Provides the System.Runtime.CompilerServices.Unsafe class, which provides generic, low-level functionality for manipulating pointers.

Commonly Used Types:

  • System.Runtime.CompilerServices.Unsafe

This package adds support for System.Runtime.CompilerServices.Unsafe on .NET Framework 4.0.

This is a compilation using the System.Runtime.CompilerServices.Unsafe source code from .NET Core 6.0.28. All tests are passing.

This is not meant to be an upgrade to System.Runtime.CompilerServices.Unsafe 6.0.0, it is simply to add support on the net40 target for all of the existing APIs in System.Runtime.CompilerServices.Unsafe 6.0.0. It is recommended to use the official release of System.Runtime.CompilerServices.Unsafe on newer versions of .NET.

Interop with System.Runtime.CompilerServices.Unsafe on Targets > net40

Since the runtime for net40 hasn't been supported for many years, most likely you will be using a newer runtime with this library. But you may be interoperating with other components that target System.Runtime.CompilerServices.Unsafe, which will cause type collisions by default.

In this case, it is recommended to remove System.Runtime.CompilerServices.Unsafe from compilation and add NetFx.System.Runtime.CompilerServices.Unsafe in its place. Add the following to your .csproj or .vbproj file. This example is for using net452.

  <ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">
    
    <PackageReference Include="System.Runtime.CompilerServices.Unsafe"
                      Version="6.0.0"
                      ExcludeAssets="compile;runtime" />
    <PackageReference Include="NetFx.System.Runtime.CompilerServices.Unsafe"
                      Version="4.0.0" />
  </ItemGroup>

NOTE: Only SDK-style projects are supported using this method.

For transitive dependencies (that is, dependencies that are not directly referenced) that have a net40 target, consider forcing a specific target framework.

Saying Thanks

If you find this library to be useful, please star us on GitHub and consider a sponsorship so we can continue bringing you great free tools like this one. It really would make a big difference!

GitHub Sponsors

Product Compatible and additional computed target framework versions.
.NET Framework net40 is compatible.  net403 was computed.  net45 was computed.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on NetFx.System.Runtime.CompilerServices.Unsafe:

Package Downloads
NetFx.System.Memory

Provides types for efficient representation and pooling of managed, stack, and native memory segments and sequences of such segments, along with primitives to parse and format UTF-8 encoded text stored in those memory segments. Commonly Used Types: System.Span System.ReadOnlySpan System.Memory System.ReadOnlyMemory System.Buffers.MemoryPool System.Buffers.ReadOnlySequence System.Buffers.Text.Utf8Parser System.Buffers.Text.Utf8Formatter

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
4.0.0 101 4/13/2024
4.0.0-alpha-0016 109 4/1/2024
4.0.0-alpha-0013 70 3/31/2024