Skip to content

Instantly share code, notes, and snippets.

View gfraiteur's full-sized avatar

Gael Fraiteur gfraiteur

View GitHub Profile
@gfraiteur
gfraiteur / Microsoft.PowerShell_profile.ps1
Last active January 3, 2022 15:04
My PowerShell profile
# Save this file to: C:\Users\GaelFraiteur\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
# PowerShell parameter completion shim for the dotnet CLI
Register-ArgumentCompleter -Native -CommandName dotnet -ScriptBlock {
param($commandName, $wordToComplete, $cursorPosition)
dotnet complete --position $cursorPosition "$wordToComplete" | ForEach-Object {
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
}
}
/// <summary>
/// Appends the indent string, context description, and the record kind to the current <see cref="StringBuilder"/>.
/// </summary>
protected virtual void AppendProlog()
{
#if DEBUG
if ( this.StringBuilder != this.actionStringBuilder )
throw new AssertionFailedException();
#endif
Param
(
[string] $artifactsPath,
[string] $scanResponsePath = ''
)
$ErrorActionPreference = "Stop"
trap
{
@gfraiteur
gfraiteur / gist:1834882
Created February 15, 2012 10:16
Debug a StackOverflowException in 1 minute with PostSharp
using System;
using PostSharp.Aspects;
using PostSharp.Aspects.Configuration;
using PostSharp.Aspects.Serialization;
using Resonance.Messenging.Diagnostics;
[assembly: StackOverflowDetection]
namespace Resonance.Messenging.Diagnostics
{
@gfraiteur
gfraiteur / gist:1471809
Created December 13, 2011 11:34
A debugging aspect that throws an exception is an object is used by several threads simultaneously
using System.Diagnostics;
using System.Threading;
using PostSharp.Aspects;
using PostSharp.Aspects.Advices;
using PostSharp.Aspects.Configuration;
using PostSharp.Aspects.Serialization;
using PostSharp.Extensibility;
namespace Resonance.Messenging.Threading
{
using System.Collections.Generic;
using System.Xml;
using PostSharp.Sdk.CodeModel;
namespace PostSharp.AddIn.PostObfuscation.Dotfuscator
{
internal sealed class DotfuscatorMap : ObfuscationMap
{
protected override string GetSignature( IWriteReflectionName member )
{