Skip to content

Commit

Permalink
Add .NET 8 target
Browse files Browse the repository at this point in the history
  • Loading branch information
slozier committed Jun 25, 2024
1 parent 25a7308 commit 1972d82
Show file tree
Hide file tree
Showing 34 changed files with 152 additions and 80 deletions.
9 changes: 7 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ dotnet_diagnostic.CA1305.severity = none # CA1305: Specify IFormatProvide
dotnet_diagnostic.CA1307.severity = suggestion # CA1307: Specify StringComparison for clarity
dotnet_diagnostic.CA1309.severity = suggestion # CA1309: Use ordinal string comparison
dotnet_diagnostic.CA1310.severity = warning # CA1310: Specify StringComparison for correctness
dotnet_diagnostic.CA1510.severity = none # CA1510: Use ArgumentNullException throw helper
dotnet_diagnostic.CA1512.severity = none # CA1512: Use ArgumentOutOfRangeException throw helper
dotnet_diagnostic.CA1513.severity = none # CA1513: Use ObjectDisposedException throw helper
dotnet_diagnostic.CA1707.severity = none # CA1707: Identifiers should not contain underscores
dotnet_diagnostic.CA1708.severity = none # CA1708: Identifiers should differ by more than case
dotnet_diagnostic.CA1710.severity = none # CA1710: Identifiers should have correct suffix
Expand All @@ -70,7 +73,6 @@ dotnet_diagnostic.CA1805.severity = suggestion # CA1805: Do not initialize unne
dotnet_diagnostic.CA1806.severity = none # CA1806: Do not ignore method results
dotnet_diagnostic.CA1816.severity = suggestion # CA1816: Dispose methods should call SuppressFinalize
dotnet_diagnostic.CA1822.severity = none # CA1822: Mark members as static
dotnet_diagnostic.CA1825.severity = none # CA1825: Avoid zero-length array allocations
dotnet_diagnostic.CA1830.severity = suggestion # CA1830: Prefer strongly-typed Append and Insert method overloads on StringBuilder
dotnet_diagnostic.CA1834.severity = suggestion # CA1834: Consider using 'StringBuilder.Append(char)' when applicable
dotnet_diagnostic.CA1837.severity = suggestion # CA1837: Use 'Environment.ProcessId'
Expand All @@ -79,9 +81,9 @@ dotnet_diagnostic.CA1845.severity = none # CA1845: Use span-based 'string
dotnet_diagnostic.CA1846.severity = none # CA1846: Prefer 'AsSpan' over 'Substring'
dotnet_diagnostic.CA1847.severity = none # CA1847: Use char literal for a single character lookup
dotnet_diagnostic.CA1852.severity = suggestion # CA1852: Seal internal types
dotnet_diagnostic.CA1854.severity = suggestion # CA1854: Prefer the 'IDictionary.TryGetValue(TKey, out TValue)' method
dotnet_diagnostic.CA1859.severity = suggestion # CA1859: Use concrete types when possible for improved performance
dotnet_diagnostic.CA1861.severity = suggestion # CA1861: Avoid constant arrays as arguments
dotnet_diagnostic.CA1863.severity = none # CA1863: Use 'CompositeFormat'
dotnet_diagnostic.CA2101.severity = suggestion # CA2101: Specify marshaling for P/Invoke string arguments
dotnet_diagnostic.CA2201.severity = none # CA2201: Do not raise reserved exception types
dotnet_diagnostic.CA2208.severity = suggestion # CA2208: Instantiate argument exceptions correctly
Expand All @@ -94,3 +96,6 @@ dotnet_diagnostic.CA5350.severity = suggestion # CA5350: Do Not Use Weak Crypto
dotnet_diagnostic.CA5351.severity = suggestion # CA5351: Do Not Use Broken Cryptographic Algorithms
dotnet_diagnostic.CA5359.severity = suggestion # CA5359: Do Not Disable Certificate Validation
dotnet_diagnostic.CA5372.severity = suggestion # CA5372: Use XmlReader For XPathDocument

dotnet_diagnostic.SYSLIB1045.severity = suggestion # SYSLIB1045: Use 'RegexGeneratorAttribute' to generate the regular expression implementation at compile-time
dotnet_diagnostic.SYSLIB1054.severity = suggestion # SYSLIB1054: Use 'LibraryImportAttribute' instead of 'DllImportAttribute' to generate P/Invoke marshalling code at compile time
1 change: 0 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.0.x'
include-prerelease: true
- name: Build
run: pwsh make.ps1
- name: Package
Expand Down
2 changes: 1 addition & 1 deletion Build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
Outputs="$(PackageDir)\DynamicLanguageRuntime.$(PackageVersion).zip">
<ItemGroup>
<ZipFiles Include="$(StageDir)\**\*.dll;$(StageDir)\**\*.xml;$(StageDir)\README.md;$(StageDir)\LICENSE"
Exclude="$(StageDir)\netcoreapp3.1\*;$(StageDir)\net7.0*\*;$(StageDir)\net8.0*\*" />
Exclude="$(StageDir)\netcoreapp3.1\*;$(StageDir)\net7.0*\*;$(StageDir)\net8.0*\*;$(StageDir)\net9.0*\*" />
</ItemGroup>
<Message Text="$(ZipFiles)" />
<Zip Files="@(ZipFiles)" ZipFileName="$(PackageDir)\DynamicLanguageRuntime.$(PackageVersion).zip" WorkingDirectory="$(StageDir)"/>
Expand Down
37 changes: 37 additions & 0 deletions Build/net8.0.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<IsFullFramework>false</IsFullFramework>
</PropertyGroup>

<PropertyGroup>
<Features>$(Features);FEATURE_APARTMENTSTATE</Features>
<Features>$(Features);FEATURE_ASSEMBLY_GETFORWARDEDTYPES</Features>
<Features>$(Features);FEATURE_ASSEMBLY_RESOLVE</Features>
<Features>$(Features);FEATURE_ASSEMBLYBUILDER_DEFINEDYNAMICASSEMBLY</Features>
<Features>$(Features);FEATURE_CODEDOM</Features>
<Features>$(Features);FEATURE_COM</Features>
<Features>$(Features);FEATURE_CONFIGURATION</Features>
<Features>$(Features);FEATURE_CUSTOM_TYPE_DESCRIPTOR</Features>
<Features>$(Features);FEATURE_EXCEPTION_STATE</Features>
<Features>$(Features);FEATURE_FILESYSTEM</Features>
<Features>$(Features);FEATURE_FULL_CRYPTO</Features>
<Features>$(Features);FEATURE_FULL_NET</Features>
<Features>$(Features);FEATURE_LCG</Features>
<Features>$(Features);FEATURE_LOADWITHPARTIALNAME</Features>
<Features>$(Features);FEATURE_METADATA_READER</Features>
<Features>$(Features);FEATURE_MMAP</Features>
<Features>$(Features);FEATURE_NATIVE</Features>
<Features>$(Features);FEATURE_PIPES</Features>
<Features>$(Features);FEATURE_PROCESS</Features>
<Features>$(Features);FEATURE_REFEMIT</Features>
<Features>$(Features);FEATURE_REGISTRY</Features>
<Features>$(Features);FEATURE_SECURITY_RULES</Features>
<Features>$(Features);FEATURE_STACK_TRACE</Features>
<Features>$(Features);FEATURE_SYNC_SOCKETS</Features>
<Features>$(Features);FEATURE_THREAD</Features>
<Features>$(Features);FEATURE_TYPE_EQUIVALENCE</Features>
<Features>$(Features);FEATURE_TYPECONVERTER</Features>
<Features>$(Features);FEATURE_XMLDOC</Features>
</PropertyGroup>
</Project>
1 change: 1 addition & 0 deletions Dlr.sln
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{60056F49
Build\After.targets = Build\After.targets
Build\net462.props = Build\net462.props
Build\net6.0.props = Build\net6.0.props
Build\net8.0.props = Build\net8.0.props
Build\netstandard2.0.props = Build\netstandard2.0.props
Build\steps.yml = Build\steps.yml
EndProjectSection
Expand Down
3 changes: 3 additions & 0 deletions Package/nuget/DynamicLanguageRuntime.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
<group targetFramework="net6.0">
<dependency id="System.CodeDom" version="6.0.0" />
</group>
<group targetFramework="net8.0">
<dependency id="System.CodeDom" version="8.0.0" />
</group>
</dependencies>
</metadata>
<files>
Expand Down
2 changes: 1 addition & 1 deletion Src/Microsoft.Dynamic/Actions/Calls/ArgumentBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace Microsoft.Scripting.Actions.Calls {
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1815:OverrideEqualsAndOperatorEqualsOnValueTypes")] // TODO
public struct ArgumentBinding {
private static readonly int[] _EmptyBinding = new int[0];
private static readonly int[] _EmptyBinding = System.Array.Empty<int>();

private readonly int _positionalArgCount;
private readonly int[] _binding; // immutable
Expand Down
2 changes: 1 addition & 1 deletion Src/Microsoft.Dynamic/Actions/MemberTracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace Microsoft.Scripting.Actions {
/// </summary>
public abstract class MemberTracker {
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2105:ArrayFieldsShouldNotBeReadOnly")]
public static readonly MemberTracker[] EmptyTrackers = new MemberTracker[0];
public static readonly MemberTracker[] EmptyTrackers = Array.Empty<MemberTracker>();

private static readonly Dictionary<MemberKey, MemberTracker> _trackers = new Dictionary<MemberKey, MemberTracker>();

Expand Down
22 changes: 10 additions & 12 deletions Src/Microsoft.Dynamic/Actions/NamespaceTracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ internal NamespaceTracker GetOrMakeChildPackage(string childName, Assembly assem

if (_dict.TryGetValue(childName, out MemberTracker ret)) {
// If we have a module, then we add the assembly to the InnerModule
// If it's not a module, we'll wipe it out below, eg "def System(): pass" then
// If it's not a module, we'll wipe it out below, eg "def System(): pass" then
// "import System" will result in the namespace being visible.
if (ret is NamespaceTracker package) {
if (!package._packageAssemblies.Contains(assem)) {
Expand Down Expand Up @@ -102,10 +102,11 @@ internal void AddTypeName(string typeName, Assembly assem) {
Assert.NotNull(typeName, assem);
Debug.Assert(typeName.IndexOf('.') == -1); // This is the simple name, not the full name

if (!_typeNames.ContainsKey(assem)) {
_typeNames[assem] = new TypeNames(assem, _fullName);
if (!_typeNames.TryGetValue(assem, out TypeNames typeNames)) {
typeNames = new TypeNames(assem, _fullName);
_typeNames[assem] = typeNames;
}
_typeNames[assem].AddTypeName(typeName);
typeNames.AddTypeName(typeName);

string normalizedTypeName = ReflectionUtils.GetNormalizedTypeName(typeName);
if (_dict.ContainsKey(normalizedTypeName)) {

Check failure on line 112 in Src/Microsoft.Dynamic/Actions/NamespaceTracker.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Prefer a 'TryGetValue' call over a Dictionary indexer access guarded by a 'ContainsKey' check to avoid double lookup (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1854)

Check failure on line 112 in Src/Microsoft.Dynamic/Actions/NamespaceTracker.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Prefer a 'TryGetValue' call over a Dictionary indexer access guarded by a 'ContainsKey' check to avoid double lookup (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1854)

Check failure on line 112 in Src/Microsoft.Dynamic/Actions/NamespaceTracker.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Prefer a 'TryGetValue' call over a Dictionary indexer access guarded by a 'ContainsKey' check to avoid double lookup (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1854)

Check failure on line 112 in Src/Microsoft.Dynamic/Actions/NamespaceTracker.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Prefer a 'TryGetValue' call over a Dictionary indexer access guarded by a 'ContainsKey' check to avoid double lookup (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1854)

Check failure on line 112 in Src/Microsoft.Dynamic/Actions/NamespaceTracker.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Prefer a 'TryGetValue' call over a Dictionary indexer access guarded by a 'ContainsKey' check to avoid double lookup (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1854)

Check failure on line 112 in Src/Microsoft.Dynamic/Actions/NamespaceTracker.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Prefer a 'TryGetValue' call over a Dictionary indexer access guarded by a 'ContainsKey' check to avoid double lookup (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1854)
Expand Down Expand Up @@ -194,9 +195,9 @@ private NamespaceTracker GetOrMakePackageHierarchy(Assembly assem, string fullNa
}
/// <summary>
/// As a fallback, so if the type does exist in any assembly. This would happen if a new type was added
/// that was not in the hardcoded list of types.
/// that was not in the hardcoded list of types.
/// This code is not accurate because:
/// 1. We dont deal with generic types (TypeCollision).
/// 1. We dont deal with generic types (TypeCollision).
/// 2. Previous calls to GetCustomMemberNames (eg. "from foo import *" in Python) would not have included this type.
/// 3. This does not deal with new namespaces added to the assembly
/// </summary>
Expand All @@ -215,7 +216,7 @@ private MemberTracker CheckForUnlistedType(string nameString) {
continue;
}

// We dont use TypeCollision.UpdateTypeEntity here because we do not handle generic type names
// We dont use TypeCollision.UpdateTypeEntity here because we do not handle generic type names
return TypeTracker.GetTypeTracker(type);
}

Expand Down Expand Up @@ -309,7 +310,7 @@ private IList AddKeys(IList res) {
}
}
}

return res;
}

Expand Down Expand Up @@ -405,10 +406,7 @@ internal void AddTypeName(string typeName) {
if (normalizedName == typeName) {
_simpleTypeNames.Add(typeName);
} else {
List<string> actualNames;
if (_genericTypeNames.ContainsKey(normalizedName)) {
actualNames = _genericTypeNames[normalizedName];
} else {
if (!_genericTypeNames.TryGetValue(normalizedName, out List<string> actualNames)) {
actualNames = new List<string>();
_genericTypeNames[normalizedName] = actualNames;
}
Expand Down
4 changes: 4 additions & 0 deletions Src/Microsoft.Dynamic/ComInterop/ComInterop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ internal interface IDispatchForReflection {
InterfaceType(ComInterfaceType.InterfaceIsIUnknown),
Guid("00020400-0000-0000-C000-000000000046"),
]
#pragma warning disable SYSLIB1096 // Convert to 'GeneratedComInterface'
internal interface IDispatch {
#pragma warning restore SYSLIB1096 // Convert to 'GeneratedComInterface'

[PreserveSig]
int TryGetTypeInfoCount(out uint pctinfo);
Expand Down Expand Up @@ -75,7 +77,9 @@ internal enum IDispatchMethodIndices {
InterfaceType(ComInterfaceType.InterfaceIsIUnknown),
Guid("B196B283-BAB4-101A-B69C-00AA00341D07")
]
#pragma warning disable SYSLIB1096 // Convert to 'GeneratedComInterface'
internal interface IProvideClassInfo {
#pragma warning restore SYSLIB1096 // Convert to 'GeneratedComInterface'
void GetClassInfo(out IntPtr info);
}

Expand Down
2 changes: 1 addition & 1 deletion Src/Microsoft.Dynamic/ComInterop/ComParamDesc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ internal ComParamDesc(ref ELEMDESC elemDesc, string name) {
break;
}

TYPEDESC childTypeDesc = (TYPEDESC)Marshal.PtrToStructure(typeDesc.lpValue, typeof(TYPEDESC));
TYPEDESC childTypeDesc = Marshal.PtrToStructure<TYPEDESC>(typeDesc.lpValue);
_vt = (VarEnum)childTypeDesc.vt;
typeDesc = childTypeDesc;
}
Expand Down
8 changes: 4 additions & 4 deletions Src/Microsoft.Dynamic/ComInterop/ComRuntimeHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ internal static ComTypes.TYPEATTR GetTypeAttrForTypeInfo(ComTypes.ITypeInfo type
}

try {
return (ComTypes.TYPEATTR)Marshal.PtrToStructure(pAttrs, typeof(ComTypes.TYPEATTR));
return Marshal.PtrToStructure<ComTypes.TYPEATTR>(pAttrs);
} finally {
typeInfo.ReleaseTypeAttr(pAttrs);
}
Expand All @@ -203,7 +203,7 @@ internal static ComTypes.TYPELIBATTR GetTypeAttrForTypeLib(ComTypes.ITypeLib typ
}

try {
return (ComTypes.TYPELIBATTR)Marshal.PtrToStructure(pAttrs, typeof(ComTypes.TYPELIBATTR));
return Marshal.PtrToStructure<ComTypes.TYPELIBATTR>(pAttrs);
} finally {
typeLib.ReleaseTLibAttr(pAttrs);
}
Expand Down Expand Up @@ -541,7 +541,7 @@ private static IUnknownReleaseDelegate Create_IUnknownRelease() {
method.Emit(OpCodes.Ldarg_0);

// functionPtr = *(IntPtr*)(*(interfacePointer) + VTABLE_OFFSET)
int iunknownReleaseOffset = ((int)IDispatchMethodIndices.IUnknown_Release) * Marshal.SizeOf(typeof(IntPtr));
int iunknownReleaseOffset = ((int)IDispatchMethodIndices.IUnknown_Release) * Marshal.SizeOf<IntPtr>();
method.Emit(OpCodes.Ldarg_0);
method.Emit(OpCodes.Ldind_I);
method.Emit(OpCodes.Ldc_I4, iunknownReleaseOffset);
Expand Down Expand Up @@ -653,7 +653,7 @@ private static IDispatchInvokeDelegate Create_IDispatchInvoke(bool returnResult)
EmitLoadArg(method, argErrIndex);

// functionPtr = *(IntPtr*)(*(dispatchPointer) + VTABLE_OFFSET)
int idispatchInvokeOffset = ((int)IDispatchMethodIndices.IDispatch_Invoke) * Marshal.SizeOf(typeof(IntPtr));
int idispatchInvokeOffset = ((int)IDispatchMethodIndices.IDispatch_Invoke) * Marshal.SizeOf<IntPtr>();
EmitLoadArg(method, dispatchPointerIndex);
method.Emit(OpCodes.Ldind_I);
method.Emit(OpCodes.Ldc_I4, idispatchInvokeOffset);
Expand Down
2 changes: 1 addition & 1 deletion Src/Microsoft.Dynamic/ComInterop/ComTypeEnumDesc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ internal ComTypeEnumDesc(ComTypes.ITypeInfo typeInfo, ComTypeLibDesc typeLibDesc
ComTypes.VARDESC varDesc;

try {
varDesc = (ComTypes.VARDESC)Marshal.PtrToStructure(p, typeof(ComTypes.VARDESC));
varDesc = Marshal.PtrToStructure<ComTypes.VARDESC>(p);

if (varDesc.varkind == ComTypes.VARKIND.VAR_CONST) {
memberValues[i] = Marshal.GetObjectForNativeVariant(varDesc.desc.lpvarValue);
Expand Down
4 changes: 2 additions & 2 deletions Src/Microsoft.Dynamic/ComInterop/ExcepInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ internal struct ExcepInfo {
#if DEBUG
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2207:InitializeValueTypeStaticFieldsInline")]
static ExcepInfo() {
Debug.Assert(Marshal.SizeOf(typeof(ExcepInfo)) == Marshal.SizeOf(typeof(ComTypes.EXCEPINFO)));
Debug.Assert(Marshal.SizeOf<ExcepInfo>() == Marshal.SizeOf<ComTypes.EXCEPINFO>());
}
#endif

Expand Down Expand Up @@ -99,4 +99,4 @@ internal Exception GetException() {
}
}

#endif
#endif
2 changes: 1 addition & 1 deletion Src/Microsoft.Dynamic/ComInterop/IDispatchComObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ private static void GetFuncDescForDescIndex(ComTypes.ITypeInfo typeInfo, int fun
throw Error.CannotRetrieveTypeInformation();
}

funcDesc = (ComTypes.FUNCDESC)Marshal.PtrToStructure(pFuncDesc, typeof(ComTypes.FUNCDESC));
funcDesc = Marshal.PtrToStructure<ComTypes.FUNCDESC>(pFuncDesc);
funcDescHandle = pFuncDesc;
}

Expand Down
4 changes: 2 additions & 2 deletions Src/Microsoft.Dynamic/ComInterop/Variant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ internal struct Variant {
static Variant() {
// Variant size is the size of 4 pointers (16 bytes) on a 32-bit processor,
// and 3 pointers (24 bytes) on a 64-bit processor.
int intPtrSize = Marshal.SizeOf(typeof(IntPtr));
int variantSize = Marshal.SizeOf(typeof(Variant));
int intPtrSize = Marshal.SizeOf<IntPtr>();
int variantSize = Marshal.SizeOf<Variant>();
if (intPtrSize == 4) {
Debug.Assert(variantSize == (4 * intPtrSize));
} else {
Expand Down
2 changes: 1 addition & 1 deletion Src/Microsoft.Dynamic/Debugging/ThreadLocal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace Microsoft.Scripting.Debugging {
internal class ThreadLocal<T> {
private StorageInfo[] _stores; // array of storage indexed by managed thread ID
private static readonly StorageInfo[] Updating = new StorageInfo[0]; // a marker used when updating the array
private static readonly StorageInfo[] Updating = Array.Empty<StorageInfo>(); // a marker used when updating the array

internal T Value {
get {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ private void ParseOption(string arg, out string name, out string value) {
}

if (name.StartsWith("--", StringComparison.Ordinal)) name = name.Substring("--".Length);
else if (name.StartsWith("-", StringComparison.Ordinal) && name.Length > 1) name = name.Substring("-".Length);
else if (name.StartsWith("/", StringComparison.Ordinal) && name.Length > 1) name = name.Substring("/".Length);
else if (name.StartsWith('-') && name.Length > 1) name = name.Substring("-".Length);
else if (name.StartsWith('/') && name.Length > 1) name = name.Substring("/".Length);
else {
value = name;
name = null;
Expand Down
2 changes: 1 addition & 1 deletion Src/Microsoft.Dynamic/Interpreter/LightCompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public sealed class LightCompiler {

private readonly LightCompiler _parent;

private static readonly LocalDefinition[] EmptyLocals = new LocalDefinition[0];
private static readonly LocalDefinition[] EmptyLocals = Array.Empty<LocalDefinition>();

internal LightCompiler(int compilationThreshold) {
Instructions = new InstructionList();
Expand Down
2 changes: 1 addition & 1 deletion Src/Microsoft.Dynamic/Microsoft.Dynamic.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net462;netstandard2.0;net6.0</TargetFrameworks>
<TargetFrameworks>net462;netstandard2.0;net6.0;net8.0</TargetFrameworks>
<RootNamespace>Microsoft.Scripting</RootNamespace>
<BaseAddress>859832320</BaseAddress>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand Down
2 changes: 1 addition & 1 deletion Src/Microsoft.Dynamic/Runtime/SavableScriptCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public static ScriptCode[] LoadFromAssembly(ScriptDomainManager runtime, Assembl
// get the type which has our cached code...
Type t = assembly.GetType("DLRCachedCode");
if (t == null) {
return new ScriptCode[0];
return Array.Empty<ScriptCode>();
}

List<ScriptCode> codes = new List<ScriptCode>();
Expand Down
31 changes: 31 additions & 0 deletions Src/Microsoft.Dynamic/SerializationStubs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the Apache 2.0 license.
// See the LICENSE file in the project root for more information.

#if !FEATURE_SERIALIZATION

using System;
using System.Diagnostics;

namespace Microsoft.Scripting {
[Conditional("STUB")]
internal class SerializableAttribute : Attribute {
}

[Conditional("STUB")]
internal class NonSerializedAttribute : Attribute {
}

namespace Runtime {
internal interface ISerializable {
}

internal interface IDeserializationCallback {
}
}

internal class SerializationException : Exception {
}
}

#endif
Loading

0 comments on commit 1972d82

Please sign in to comment.