Skip to content

Instantly share code, notes, and snippets.

View Nihlus's full-sized avatar

Jarl Gullberg Nihlus

View GitHub Profile
using System;
using System.Threading.Tasks;
using Discord;
using Discord.Commands;
using Discord.WebSocket;
using Microsoft.Extensions.DependencyInjection;
namespace BugRepro
{
class Program
// <auto-generated />
#pragma warning disable CS1591
// ReSharper disable RedundantArgumentDefaultValue
// ReSharper disable PartialTypeWithSinglePart
// ReSharper disable RedundantUsingDirective
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;
namespace DIGOS.Ambassador.Migrations
// Accel.cs - customizations to Gtk.Accel
//
// Authors: Mike Kestner <mkestner@ximian.com>
//
// Copyright (c) 2004-2005 Novell, Inc.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of version 2 of the Lesser GNU General
// Public License as published by the Free Software Foundation.
//
System.TypeLoadException: Could not load type 'DynamicType' from assembly 'DynamicAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
at System.RuntimeTypeHandle.GetDeclaringType(RuntimeType type)
at System.RuntimeType.RuntimeTypeCache.GetEnclosingType()
at System.RuntimeType.get_DeclaringType()
at System.Reflection.Emit.ModuleBuilder.GetTypeRefNested(Type type, Module refedModule, String strRefedModuleFileName)
at System.Reflection.Emit.ModuleBuilder.GetTypeTokenWorkerNoLock(Type type, Boolean getGenericDefinition)
at System.Reflection.Emit.ModuleBuilder.GetTypeTokenInternal(Type type, Boolean getGenericDefinition)
at System.Reflection.Emit.ModuleBuilder.GetTypeToken(Type type)
at System.Reflection.Emit.SignatureHelper.AddOneArgTypeHelperWorker(Type clsArgument, Boolean lastWasGenericInst)
at System.Reflection.Emit.SignatureHelper.AddOneArgTypeHelper(Type clsArgument)
namespace AdvancedDLSupport.CallWrappers
{
/// <summary>
/// Represents a wrapper emitter that accepts a method, emits arbitrary prologue instructions, calls the method, and
/// then emits arbitrary epilogue instructions. Typically, the input method is passed through without modifications.
/// </summary>
public interface ICallWrapper : IImplementationGenerator<IntrospectiveMethodInfo>
{
/// <summary>
/// Determines whether or not the call wrapper is applicable for the given method definition.
BenchmarkDotNet=v0.10.14, OS=Windows 10.0.16299.371 (1709/FallCreatorsUpdate/Redstone3)
Intel Core i7-7600U CPU 2.80GHz (Kaby Lake), 1 CPU, 4 logical and 2 physical cores
Frequency=2835937 Hz, Resolution=352.6171 ns, Timer=TSC
[Host] : .NET Framework 4.7.1 (CLR 4.0.30319.42000), 64bit RyuJIT-v4.7.2633.0
Clr : .NET Framework 4.7.1 (CLR 4.0.30319.42000), 64bit RyuJIT-v4.7.2633.0
Method | Mean | Error | StdDev |
------------------------------------- |---------:|----------:|----------:|
ManagedByRef | 26.74 ns | 0.3286 ns | 0.3074 ns |
CalliByRef | 27.00 ns | 0.4233 ns | 0.3960 ns |
BenchmarkDotNet=v0.10.14, OS=linuxmint 18.3
Intel Core i7-4790K CPU 4.00GHz (Haswell), 1 CPU, 8 logical and 4 physical cores
.NET Core SDK=2.1.4
[Host] : .NET Core 2.0.5 (CoreCLR 4.6.0.0, CoreFX 4.6.26018.01), 64bit RyuJIT
Core : .NET Core 2.0.5 (CoreCLR 4.6.0.0, CoreFX 4.6.26018.01), 64bit RyuJIT
Method | Mean | Error | StdDev |
------------------------------------- |----------:|----------:|----------:|
ManagedByRef | 3.660 ns | 0.0045 ns | 0.0042 ns |
BenchmarkDotNet=v0.10.14, OS=linuxmint 18.3
Intel Core i7-4790K CPU 4.00GHz (Haswell), 1 CPU, 8 logical and 4 physical cores
[Host] : Mono 5.10.1.42 (tarball Wed), 64bit
Mono : Mono 5.10.1.42 (tarball Wed), 64bit
Method | Mean | Error | StdDev |
------------------------------------- |-------------:|-----------:|-----------:|
CalliByRef | 8.774 ns | 0.1943 ns | 0.1723 ns |
DllImportByRef | 10.844 ns | 0.0133 ns | 0.0125 ns |
private IntPtr Multiply_ptr;
public Math()
{
Multiply_ptr = LoadSymbol(_libraryPtr, nameof(Multiply));
}
public int Multiply(int a, int b)
{
ldarg a;
private delegate int Multiply_dt(int a, int b);
private Multiply_dt Multiply_dtm;
public Math()
{
var symbolPtr = LoadSymbol(_libraryPtr, nameof(Multiply));
Multiply_dtm = (Multiply_dt)Marshal.GetDelegateForFunctionPointer(symbolPtr, typeof(Multiply_dt));
}
public int Multiply(int a, int b)