This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# git bisect start --first-parent 5283fb074640b1 23d9058db6921f0f4849cd78d726e6cbb375c46c -- src/Nerdbank.MessagePack | |
# git bisect run pwsh.exe ./GetSize.ps1 | |
$env:UseSharedCompilation='false' # prevent dotnet.exe from locking up between iterations | |
Write-Host "Git clean" -ForegroundColor Yellow | |
git clean -fdX -e obj/tools :/ | |
Write-Host "Running init" -ForegroundColor Yellow | |
./init.ps1 -InstallLocality repo | |
if ($LASTEXITCODE -ne 0) { Write-Host "Aborting after exit code $LASTEXITCODE"; exit 125 } | |
Write-Host "Running publish" -ForegroundColor Yellow | |
dotnet publish test\AotNativeConsole |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Diagnostics; | |
using System.Runtime.CompilerServices; | |
internal static class AvoidCrashingOnDebugAsserts | |
{ | |
[ModuleInitializer] | |
internal static void Initializer() | |
{ | |
if (Trace.Listeners.OfType<DefaultTraceListener>().FirstOrDefault() is { AssertUiEnabled: true } defaultListener) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"type": "object", | |
"title": "Model Context Protocol Servers", | |
"additionalProperties": false, | |
"properties": { | |
"$schema": { | |
"type": "string", | |
"format": "uri" | |
}, | |
"inputs": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Nerdbank.MessagePack; // Comes from the Nerdbank.MessagePack nuget package | |
using PolyType; | |
namespace MessagePackBug; | |
[GenerateShape] | |
public partial record ItemsRequest( | |
[property:Key(0)] | |
string Prop1, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Reflection.Metadata; | |
class CustomAttributeTypeProvider : ICustomAttributeTypeProvider<Type> | |
{ | |
internal static readonly CustomAttributeTypeProvider Instance = new(); | |
public Type GetPrimitiveType(PrimitiveTypeCode typeCode) | |
{ | |
return SignatureTypeProvider.Instance.GetPrimitiveType(typeCode); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Encrypt-DataAsymmetric { | |
[CmdletBinding()] | |
Param | |
( | |
[Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true, Position = 0)] | |
[byte[]]$Data, | |
[Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true, Position = 1)] | |
[byte[]]$PublicKey | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Inspired by https://github.com/MicrosoftDocs/azure-devops-docs/blob/main/docs/pipelines/agents/docker.md#linux | |
FROM ubuntu:22.04 | |
ENV TARGETARCH="linux-x64" | |
# Also can be "linux-arm", "linux-arm64". | |
# Add a Capability that pipelines can filter to when they require a linux agent that supports creating docker containers. | |
ENV HasDockerAccess="true" | |
RUN apt-get update | |
RUN apt-get upgrade -y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Concurrent; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var ordinary = RunTest(OrdinaryDictionaryRun); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Security.Cryptography; | |
public static class SecurityUtilities | |
{ | |
static void Main(string[] args) | |
{ | |
Console.WriteLine(GeneratePat()); | |
Console.WriteLine(GeneratePat()); | |
Console.WriteLine(GeneratePat()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
static async Task Main(string[] args) | |
{ | |
// Add this to your C# console app's Main method to give yourself | |
// a CancellationToken that is canceled when the user hits Ctrl+C. | |
var cts = new CancellationTokenSource(); | |
Console.CancelKeyPress += (s, e) => | |
{ | |
Console.WriteLine("Canceling..."); |
NewerOlder