Skip to content

Commit de878ad

Browse files
committed
Added support for .NET 10
1 parent 24f0ebc commit de878ad

40 files changed

+134
-42
lines changed

src/JavaScriptEngineSwitcher.ChakraCore/ChakraCoreJsEngine.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using System;
2-
#if NET45_OR_GREATER || NETSTANDARD
2+
#if NET45_OR_GREATER || NETSTANDARD || NET10_0_OR_GREATER
33
using System.Runtime.InteropServices;
44
#endif
55
using System.Text;

src/JavaScriptEngineSwitcher.ChakraCore/Helpers/EncodingHelpers.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if NET45_OR_GREATER || NETSTANDARD
1+
#if NET45_OR_GREATER || NETSTANDARD || NET10_0_OR_GREATER
22
using System.Buffers;
33
#endif
44
using System.Text;
@@ -38,7 +38,7 @@ public static string UnicodeToAnsi(string value, out int byteCount)
3838

3939
try
4040
{
41-
#if NET45_OR_GREATER || NETSTANDARD
41+
#if NET45_OR_GREATER || NETSTANDARD || NET10_0_OR_GREATER
4242
result = ConvertStringInternal(utf8Encoding, ansiEncoding, value, valueLength, buffer, bufferLength);
4343
#else
4444
utf8Encoding.GetBytes(value, 0, valueLength, buffer, 0);
@@ -54,7 +54,7 @@ public static string UnicodeToAnsi(string value, out int byteCount)
5454

5555
return result;
5656
}
57-
#if NET45_OR_GREATER || NETSTANDARD
57+
#if NET45_OR_GREATER || NETSTANDARD || NET10_0_OR_GREATER
5858

5959
private static unsafe string ConvertStringInternal(Encoding srcEncoding, Encoding dstEncoding, string s,
6060
int charCount, byte[] bytes, int byteCount)

src/JavaScriptEngineSwitcher.ChakraCore/Helpers/ReflectionHelpers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using System;
2-
#if NET45_OR_GREATER || NETSTANDARD
2+
#if NET45_OR_GREATER || NETSTANDARD || NET10_0_OR_GREATER
33
using System.Buffers;
44
#endif
55
using System.Collections.Generic;

src/JavaScriptEngineSwitcher.ChakraCore/JavaScriptEngineSwitcher.ChakraCore.csproj

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<Product>JS Engine Switcher: ChakraCore</Product>
55
<VersionPrefix>3.30.4</VersionPrefix>
6-
<TargetFrameworks>net40-client;net45;net471;netstandard1.3;netstandard2.0;netstandard2.1</TargetFrameworks>
6+
<TargetFrameworks>net40-client;net45;net471;netstandard1.3;netstandard2.0;netstandard2.1;net10.0</TargetFrameworks>
77
<NetStandardImplicitPackageVersion Condition=" '$(TargetFramework)' == 'netstandard1.3' ">1.6.0</NetStandardImplicitPackageVersion>
88
<OutputType>Library</OutputType>
99
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
@@ -24,8 +24,9 @@
2424
<PackageIconFullPath>../../Icons/JavaScriptEngineSwitcher_ChakraCore_Logo128x128.png</PackageIconFullPath>
2525
<Description>JavaScriptEngineSwitcher.ChakraCore contains a `ChakraCoreJsEngine` adapter (wrapper for the ChakraCore).</Description>
2626
<PackageTags>$(PackageCommonTags);ChakraCore</PackageTags>
27-
<PackageReleaseNotes>1. Performed a migration to the modern C# null/not-null checks;
28-
2. The value of a read-only field in an embedded object or type can no longer be changed.</PackageReleaseNotes>
27+
<PackageReleaseNotes>1. The value of a read-only field in an embedded object or type can no longer be changed;
28+
2. Added support for .NET 10;
29+
3. Performed a migration to the modern C# null/not-null checks.</PackageReleaseNotes>
2930
</PropertyGroup>
3031

3132
<ItemGroup>
@@ -35,8 +36,8 @@
3536
</ItemGroup>
3637

3738
<ItemGroup Condition=" '$(TargetFramework)' == 'net40-client' ">
38-
<PackageReference Include="PolyfillsForOldDotNet.System.Buffers" Version="0.1.2" />
39-
<PackageReference Include="PolyfillsForOldDotNet.System.Runtime.InteropServices.RuntimeInformation" Version="0.1.2" />
39+
<PackageReference Include="PolyfillsForOldDotNet.System.Buffers" Version="0.1.3" />
40+
<PackageReference Include="PolyfillsForOldDotNet.System.Runtime.InteropServices.RuntimeInformation" Version="0.1.3" />
4041
</ItemGroup>
4142

4243
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">

src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsEngineException.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ public JsEngineException(JsErrorCode errorCode, string message)
3737
/// </summary>
3838
/// <param name="info">The object that holds the serialized data</param>
3939
/// <param name="context">The contextual information about the source or destination</param>
40+
#if NET10_0_OR_GREATER
41+
[Obsolete(DiagnosticId = "SYSLIB0051")]
42+
#endif
4043
private JsEngineException(SerializationInfo info, StreamingContext context)
4144
: base(info, context)
4245
{ }

src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsException.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
using System;
22
#if !NETSTANDARD1_3
33
using System.Runtime.Serialization;
4+
#if !NET10_0_OR_GREATER
45
using System.Security.Permissions;
56
#endif
7+
#endif
68

79
namespace JavaScriptEngineSwitcher.ChakraCore.JsRt
810
{
@@ -54,6 +56,9 @@ public JsException(JsErrorCode errorCode, string message)
5456
/// </summary>
5557
/// <param name="info">The object that holds the serialized data</param>
5658
/// <param name="context">The contextual information about the source or destination</param>
59+
#if NET10_0_OR_GREATER
60+
[Obsolete(DiagnosticId = "SYSLIB0051")]
61+
#endif
5762
protected JsException(SerializationInfo info, StreamingContext context)
5863
: base(info, context)
5964
{
@@ -71,7 +76,11 @@ protected JsException(SerializationInfo info, StreamingContext context)
7176
/// </summary>
7277
/// <param name="info">The <see cref="SerializationInfo"/> to populate with data</param>
7378
/// <param name="context">The destination (see <see cref="StreamingContext"/>) for this serialization</param>
79+
#if NET10_0_OR_GREATER
80+
[Obsolete(DiagnosticId = "SYSLIB0051")]
81+
#else
7482
[SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)]
83+
#endif
7584
public override void GetObjectData(SerializationInfo info, StreamingContext context)
7685
{
7786
if (info is null)

src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsFatalException.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ public JsFatalException(JsErrorCode errorCode, string message)
3737
/// </summary>
3838
/// <param name="info">The object that holds the serialized data</param>
3939
/// <param name="context">The contextual information about the source or destination</param>
40+
#if NET10_0_OR_GREATER
41+
[Obsolete(DiagnosticId = "SYSLIB0051")]
42+
#endif
4043
private JsFatalException(SerializationInfo info, StreamingContext context)
4144
: base(info, context)
4245
{ }

src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsPropertyId.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using System;
2-
#if NET45_OR_GREATER || NETSTANDARD
2+
#if NET45_OR_GREATER || NETSTANDARD || NET10_0_OR_GREATER
33
using System.Buffers;
44
using System.Runtime.InteropServices;
55
#endif

src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsScriptException.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ internal JsScriptException(JsErrorCode errorCode, JsValue metadata, string messa
6666
/// </summary>
6767
/// <param name="info">The object that holds the serialized data</param>
6868
/// <param name="context">The contextual information about the source or destination</param>
69+
#if NET10_0_OR_GREATER
70+
[Obsolete(DiagnosticId = "SYSLIB0051")]
71+
#endif
6972
private JsScriptException(SerializationInfo info, StreamingContext context)
7073
: base(info, context)
7174
{ }

src/JavaScriptEngineSwitcher.ChakraCore/JsRt/JsUsageException.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ public JsUsageException(JsErrorCode errorCode, string message)
3737
/// </summary>
3838
/// <param name="info">The object that holds the serialized data</param>
3939
/// <param name="context">The contextual information about the source or destination</param>
40+
#if NET10_0_OR_GREATER
41+
[Obsolete(DiagnosticId = "SYSLIB0051")]
42+
#endif
4043
private JsUsageException(SerializationInfo info, StreamingContext context)
4144
: base(info, context)
4245
{ }

0 commit comments

Comments
 (0)