Skip to content

Instantly share code, notes, and snippets.

View KirillOsenkov's full-sized avatar

Kirill Osenkov KirillOsenkov

View GitHub Profile
var virtualStream = new ReadVirtualStream((ulong address, byte[] buffer, int byteCount, out int bytesRead) =>
{
process.ReadMemory(address, (uint)byteCount, buffer, out var bytesReadIntPtr);
bytesRead = bytesReadIntPtr.ToInt32();
return true;
}, module.BaseAddress, module.Size);
var moduleDefinition = ModuleDefinition.ReadModule(virtualStream, new ReaderParameters(ReadingMode.Deferred)
{
InMemory = true,
(GenerateDepsFile, 334253712, 10660, System.Collections.Generic.List`1[System.String])
(Csc, 198884194, 25690, System.Collections.Generic.List`1[System.String])
(Hash, 185495696, 2564, System.Collections.Generic.List`1[System.String])
(Copy, 168462918, 17588, System.Collections.Generic.List`1[System.String])
(ConvertToAbsolutePath, 162084255, 2641, System.Collections.Generic.List`1[System.String])
(ResolvePackageFileConflicts, 150844605, 3762, System.Collections.Generic.List`1[System.String])
(FindUnderPath, 116987954, 7579, System.Collections.Generic.List`1[System.String])
(ResolveAssemblyReference, 114441190, 14794, System.Collections.Generic.List`1[System.String])
(RemoveDuplicates, 72216043, 2567, System.Collections.Generic.List`1[System.String])
(MSBuild, 52024344, 37867, System.Collections.Generic.List`1[System.String])
(ResolveAssemblyReference, 481763219, 4142, System.Collections.Generic.List`1[System.String])
(Copy, 170029945, 3995, System.Collections.Generic.List`1[System.String])
(ConvertToAbsolutePath, 160853435, 686, System.Collections.Generic.List`1[System.String])
(ResolvePackageFileConflicts, 119475640, 2308, System.Collections.Generic.List`1[System.String])
(ResolvePackageAssets, 78412896, 4800, System.Collections.Generic.List`1[System.String])
(ResolveTargetingPackAssets, 63086568, 2608, System.Collections.Generic.List`1[System.String])
(RemoveDuplicates, 54251475, 2567, System.Collections.Generic.List`1[System.String])
(MSBuild, 54184363, 4225, System.Collections.Generic.List`1[System.String])
(FindUnderPath, 28355450, 1455, System.Collections.Generic.List`1[System.String])
(MsBuild, 19543733, 20, System.Collections.Generic.List`1[System.String])
Output Item(s):
ReferenceCopyLocalPaths=
F:\workspace\_work\1\s\artifacts\bin\ApiExplorerWebSite\Release\netcoreapp5.0\ApiExplorerWebSite.dll
BuildReference=true
CopyLocal=true
CopyUpToDateMarker=F:\workspace\_work\1\s\artifacts\obj\ApiExplorerWebSite\Release\netcoreapp5.0\ApiExplorerWebSite.csproj.CopyComplete
FusionName=ApiExplorerWebSite, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
HasSingleTargetFramework=true
ImageRuntime=v4.0.30319
IsRidAgnostic=true
(MSBuild, 8087, Microsoft.Build.Logging.StructuredLogger.Parameter[])
(CheckIfPackageReferenceShouldBeFrameworkReference, 4724, Microsoft.Build.Logging.StructuredLogger.Parameter[])
(ResolveAssemblyReference, 4587, Microsoft.Build.Logging.StructuredLogger.Parameter[])
(Microsoft.SourceLink.GitHub.GetSourceLinkUrl, 4062, Microsoft.Build.Logging.StructuredLogger.Parameter[])
(Microsoft.SourceLink.AzureRepos.Git.GetSourceLinkUrl, 4062, Microsoft.Build.Logging.StructuredLogger.Parameter[])
(GenerateDepsFile, 3957, Microsoft.Build.Logging.StructuredLogger.Parameter[])
(ApplyImplicitVersions, 2962, Microsoft.Build.Logging.StructuredLogger.Parameter[])
(Csc, 2554, Microsoft.Build.Logging.StructuredLogger.Parameter[])
(RemoveDuplicates, 2497, Microsoft.Build.Logging.StructuredLogger.Parameter[])
(ProcessFrameworkReferences, 2473, Microsoft.Build.Logging.StructuredLogger.Parameter[])
/// <summary>
/// Export a <see cref="IClassifierProvider"/>
/// </summary>
[Export(typeof(IClassifierProvider))]
[ContentType("code")]
internal class VideoCommentClassifierProvider : IClassifierProvider
{
[Export(typeof(ClassificationTypeDefinition))]
[Name("video comment")]
internal ClassificationTypeDefinition VideoCommentClassificationType = null;
// Variable definition
$base-color: #c6538c;
// Variable definition and reference
$border-dark: rgba($base-color, 0.88);
.alert {
// Variable reference
border: 1px solid $border-dark;
}
/// <summary>
/// A hash combiner that is implemented with the Fowler/Noll/Vo algorithm (FNV-1a). This is a mutable struct for performance reasons.
/// Taken from https://gist.github.com/StephenCleary/4f6568e5ab5bee7845943fdaef8426d2
/// </summary>
public struct FnvHash
{
/// <summary>
/// The starting point of the FNV hash.
/// </summary>
public const ulong Offset = 14695981039346656037;
class C
{
static void M(string a, string b, string c)
{
M("مرحبا بالعالم",
$"مرحبا بالعالم: {-1}",
"OK");
}
}
using System;
public partial class Program
{
private readonly string _foo;
static void Main(string[] args)
{
Console.WriteLine();
_ = ThisAssembly.Info.InformationalVersion;