Skip to content

Instantly share code, notes, and snippets.

Kevin Gosse kevingosse

Block or report user

Report or block kevingosse

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View KestrelTimeout.cs
using System;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
namespace KestrelTimeout
{
View AbnormalDelay.cs
using System;
using System.Threading;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
private static Task _sharedTask;
View Deadlock.cs
using System;
using System.Threading;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
private static ManualResetEventSlim _mutex = new ManualResetEventSlim();
private static Task _sharedTask;
View deadlock.cs
using System;
using System.Threading;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
private static ManualResetEventSlim _mutex = new ManualResetEventSlim();
private static Task _sharedTask;
View Commands.cs
[DllExport("helloworld")]
public static void HelloWorld(IntPtr client, [MarshalAs(UnmanagedType.LPStr)] string args)
{
DebuggingContext.Execute(client, args, HelloWorld);
}
private static void HelloWorld(ClrRuntime runtime, string args)
{
Console.WriteLine("The first 10 types on the heap are: ");
View Commands.cs
[DllExport("helloworld")]
public static void HelloWorld(IntPtr client, [MarshalAs(UnmanagedType.LPStr)] string args)
{
}
View Commands.cs
public static void HelloWorld(IntPtr client, [MarshalAs(UnmanagedType.LPStr)] string args)
{
}
View ThreadPoolTaskScheduler.cs
protected override void QueueTask(Task task)
{
MutateState(task);
var newScheduler = new ThreadPoolTaskScheduler();
typeof(Task).GetField("m_taskScheduler", BindingFlags.Instance | BindingFlags.NonPublic)
.SetValue(task, newScheduler);
ThreadPool.UnsafeQueueUserWorkItem(t => newScheduler.ExecuteTask((Task)t), task);
View Program.cs
class Program
{
static void Main(string[] args)
{
Task.Run(Test);
Console.ReadLine();
}
static async Task Test()
View MutateState.cs
var continuationWrapper = func.Target;
var continuation = continuationWrapper.GetType().GetField("_continuation", BindingFlags.Instance | BindingFlags.NonPublic)
.GetValue(continuationWrapper) as Action;
if (continuation != null)
{
var asyncStateMachineBox = continuation.Target;
var stateMachineField = asyncStateMachineBox?.GetType().GetField("StateMachine");
You can’t perform that action at this time.