Skip to content

Instantly share code, notes, and snippets.

View jbevain's full-sized avatar

Jb Evain jbevain

View GitHub Profile

For our Visual Studio Code extension, we implemented a debug adapter for our Unity debugger.

Part of the job is translating data structures from our debugger (say a UnityThread), to a DAP Thread. We're using a library that uses List<T> to represent collections.

I originally wrote:

UnityThread[] threads = ...;
List<DAPThread> dapThreads = threads.Select(CreateDAPThread).ToList();
@jbevain
jbevain / brittle.cs
Last active December 18, 2024 00:29
using System.Runtime.InteropServices;
unsafe class Program
{
static void Main()
{
ReadOnlySpan<byte> name = stackalloc byte[]
{
(byte)'J',
(byte)'b',
List<Machine> machines = [];
foreach (var machine in input.Split("\n\n"))
{
var lines = machine.Split("\n");
var a = Split(lines[0]);
var b = Split(lines[1]);
var prize = Split(lines[2]);
List<Machine> machines = [];
foreach (var machine in input.Split("\n\n"))
{
var lines = machine.Split("\n");
var a = Split(lines[0]);
var b = Split(lines[1]);
var prize = Split(lines[2]);
long sum = 0;
var reader = new StringReader(input);
while (reader.ReadLine() is string line)
{
var numbers = line.Split([' ', ':'], StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();
if (numbers is [var test, ..var n] && SolveEquation(test, n))
{
sum += test;
}
var state = ParseState.OrderingRules;
Dictionary<int, HashSet<int>> rules = [];
List<List<int>> pageOrders = [];
var reader = new StringReader(input);
while (reader.ReadLine() is string line)
{
if (state == ParseState.OrderingRules)
{
if (line == "")
var lines = new List<string>();
using var reader = new StreamReader(args[0]);
while (reader.ReadLine() is string line)
{
lines.Add(line);
}
var grid = new char[lines.Count, lines[0].Length];
for (var i = 0; i < lines.Count; i++)
using System.Numerics;
using System.Runtime.InteropServices;
using var reader = new StreamReader("input.txt");
List<int> left = [], right = [];
while (reader.ReadLine() is string line)
{
var lineSpan = line.AsSpan();
using System.Reflection.Metadata;
using System.Reflection.PortableExecutable;
internal struct FileVersionReader
{
private readonly PEReader _pe;
private BlobReader _reader;
public static Version? ReadFileVersion(PEReader pe)
{

Sebastian recently reported a scenario where an operation in Visual Studio took an unreasonable amount of time (15minutes) on a large Unity project (477 individual csproj in the solution).

Sebastian was kind enough to reach out and share a way to reproduce the issue.

What's happening

When all the projects of a Visual Studio solution are in an “unloaded” state.

Unloaded projects in the Solution Explorer