Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,15 @@ private Func<string[], object[], object> GetCreationDelegate(Type dictType) {
if (genArgs[0] == typeof(string) || genArgs[0] == typeof(object)) {
MethodInfo target = typeof(BinderOps).GetMethod(nameof(BinderOps.MakeReadOnlyDictionary)).MakeGenericMethod(genArgs);

func = (Func<string[], object[], object>)target.CreateDelegate(typeof(Func<string[], object[], object>));
func = target.CreateDelegate<Func<string[], object[], object>>();
}
} else if (dictType.GetGenericTypeDefinition() == typeof(IDictionary<,>) ||
dictType.GetGenericTypeDefinition() == typeof(Dictionary<,>)) {

if (genArgs[0] == typeof(string) || genArgs[0] == typeof(object)) {
MethodInfo target = typeof(BinderOps).GetMethod(nameof(BinderOps.MakeDictionary)).MakeGenericMethod(genArgs);

func = (Func<string[], object[], object>)target.CreateDelegate(typeof(Func<string[], object[], object>));
func = target.CreateDelegate<Func<string[], object[], object>>();
}
}
} else if (dictType == typeof(IDictionary)) {
Expand Down
2 changes: 1 addition & 1 deletion src/core/Microsoft.Dynamic/Hosting/Shell/BasicConsole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private static bool HasDarkBackground(bool? isDarkConsole) {
}

// Try autodetect
if (Enum.IsDefined(typeof(ConsoleColor), Console.BackgroundColor)) {
if (Enum.IsDefined(Console.BackgroundColor)) {
return IsDark(Console.BackgroundColor);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ internal static Instruction CreateDynamicInstruction(Type delegateType, CallSite
return new DynamicInstructionN(delegateType, CallSite.Create(delegateType, binder));
}

factory = (Func<CallSiteBinder, Instruction>)instructionType.GetMethod("Factory").CreateDelegate(typeof(Func<CallSiteBinder, Instruction>));
factory = instructionType.GetMethod("Factory").CreateDelegate<Func<CallSiteBinder, Instruction>>();
_factories[delegateType] = factory;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/Microsoft.Dynamic/Interpreter/LightLambda.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ private static Func<LightLambda, Delegate> MakeRunDelegateCtor(Type delegateType
name = "Make" + name + paramInfos.Length;

MethodInfo ctorMethod = typeof(LightLambda).GetMethod(name, BindingFlags.NonPublic | BindingFlags.Static).MakeGenericMethod(paramTypes);
return _runCache[delegateType] = (Func<LightLambda, Delegate>)ctorMethod.CreateDelegate(typeof(Func<LightLambda, Delegate>));
return _runCache[delegateType] = ctorMethod.CreateDelegate<Func<LightLambda, Delegate>>();
}

runMethod = typeof(LightLambda).GetMethod(name + paramInfos.Length, BindingFlags.NonPublic | BindingFlags.Instance);
Expand Down
9 changes: 3 additions & 6 deletions src/core/Microsoft.Dynamic/Microsoft.Dynamic.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,13 @@
<MeziantouPolyfill_IncludedPolyfills>
P:System.Collections.ObjectModel.ReadOnlyCollection`1.Empty;
P:System.Collections.ObjectModel.ReadOnlyDictionary`2.Empty;
M:System.Enum.IsDefined``1(``0);
M:System.Reflection.MethodInfo.CreateDelegate``1;
M:System.String.IndexOf(System.Char,System.StringComparison);
M:System.String.StartsWith(System.Char);
</MeziantouPolyfill_IncludedPolyfills>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'net9.0' OR '$(TargetFramework)' == 'net10.0' ">
<!-- Suppress CA2263 for .NET 9+ - prefer to keep consistent code across all frameworks -->
<NoWarn>$(NoWarn);CA2263</NoWarn>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Microsoft.Scripting.Metadata\Microsoft.Scripting.Metadata.csproj" Condition=" $(Features.Contains('FEATURE_METADATA_READER')) " />
<ProjectReference Include="..\Microsoft.Scripting\Microsoft.Scripting.csproj" />
Expand All @@ -32,7 +29,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Meziantou.Polyfill" Version="1.0.120">
<PackageReference Include="Meziantou.Polyfill" Version="1.0.127">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Meziantou.Polyfill" Version="1.0.120">
<PackageReference Include="Meziantou.Polyfill" Version="1.0.127">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion src/core/Microsoft.Scripting/Microsoft.Scripting.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Meziantou.Polyfill" Version="1.0.120">
<PackageReference Include="Meziantou.Polyfill" Version="1.0.127">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down
Loading