Skip to content

Instantly share code, notes, and snippets.

View jbevain's full-sized avatar

Jb Evain jbevain

View GitHub Profile
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
#if CS
using System.Runtime.InteropServices;
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Managed");
var r = Compute(12, 12);
This file has been truncated, but you can view the full file.
class Program
{
static void F_0(int a) {}
static void F_1(int a) {}
static void F_2(int a) {}
static void F_3(int a) {}
static void F_4(int a) {}
static void F_5(int a) {}
static void F_6(int a) {}
static void F_7(int a) {}
using System.Net;
using Mono.Debugger.Soft;
using static System.Console;
static int PidToPort(int pid) => 56000 + (pid % 1000);
var pid = 49149; // process ID of the Unity Editor or the IL2CPP Game
var ip = IPAddress.Loopback; // IP where the Unity Editor/Game is running
using System;
using System.IO;
using System.Linq;
using System.Xml.Linq;
namespace UnityProjectExtractor
{
internal readonly struct PathMap
{
private readonly string _projectDirectory;
using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using UnityEngine;
using UnityEditor;
#if ENABLE_VSTU