Skip to content

Instantly share code, notes, and snippets.

View drub0y's full-sized avatar

Drew Marsh drub0y

View GitHub Profile
@drub0y
drub0y / WinRTUtilities.cs
Created August 29, 2012 23:41
GetMethods WinRT
public static IEnumerable<MethodInfo> GetMethods(this Type type, string name)
{
return GetMethods(type.GetTypeInfo(), name);
}
public static IEnumerable<MethodInfo> GetMethods(this TypeInfo typeInfo, string name)
{
TypeInfo currentTypeInfo = typeInfo;
do
@drub0y
drub0y / LocalDbPrivateInstance.cs
Last active December 16, 2015 15:29
An utility class designed to work with SQL LocalDb instances inside of integration tests.
using System;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Win32;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.IO;
@drub0y
drub0y / DispatcherTaskScheduler.cs
Last active December 2, 2022 15:36
A .NET TPL TaskScheduler implementation that spins up STA threads running a Dispatcher message pump which enables the execution of logic that leverage System.Windows.* components. Why? Well, without this, the use of System.Windows.* components will create a new Dispatcher instance on the currently executing thread and since that thread is a) not…
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using System.Collections.Concurrent;
using System.Windows.Threading;
using System;
using System.Collections.Concurrent;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
namespace HackedBrain.Utilities
{
public sealed class ObjectPool<T> where T : class, new()
{
@drub0y
drub0y / NewRelicIgnoreTransactionOwinModule.cs
Created June 25, 2013 16:46
This is a proof of concept (read: not tested yet) Owin module that one could configure in an Owin pipeline to ensure that NewRelic will ignore the transaction.
public class NewRelicIgnoreTransactionOwinModule
{
private AppFunc _nextAppFunc;
public NewRelicIgnoreTransactionOwinModule(AppFunc nextAppFunc)
{
_nextAppFunc = nextAppFunc;
}
public Task Invoke(IDictionary<string, object> environment)
@drub0y
drub0y / VS2012And2013WorkflowPCLReferenceIntellisenseBug.md
Last active December 21, 2015 18:29
Details of an Intellisense bug that affects Windows Workflow Foundation projects that reference Portable Class Library assemblies.

Description

Referencing a Portable Class Library (PCL) assembly from a Windows Workflow project results in loss of Intellisense on what appears to be all other assembly type data except from mscorlib.dll, including project referenced assemblies.

Repro

  1. Create a new Windows Workflow Foundation Console Application project.
  2. Add a PCL library such as TPL Dataflow (Install-Package Microsoft.Tpl.Dataflow) or Reactive Extensions (Install-Package Rx-Main).

Expected Result

@drub0y
drub0y / TypeManager.CommitChanges.cs
Last active December 27, 2015 00:39
This is a decompiled view of how the PowerShell provider (specifically it's TypeManager class) for IIS attempts to provide consistency btwn the execution of a command and the commits actually being written to disk in applicationHost.config. All kinds of fun ensues when committing the changes to disk doesn't actually happen within that one second…
public void CommitChanges(bool doCommit)
{
if (!this.InCommitDelay() && this.WritableServerManager != null)
{
try
{
if (doCommit)
{
this.commitSynchronization = new AutoResetEvent(false);
this.WritableServerManager.CommitChanges();
@drub0y
drub0y / .gitconfig
Created April 21, 2016 19:51
VSDiffMerge as Git DiffTool/MergeTool
[diff]
tool = vsdiffmerge
[difftool]
prompt = true
[difftool "vsdiffmerge"]
cmd = \"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\IDE\\vsdiffmerge.exe\" \"$LOCAL\" \"$REMOTE\" //t
[difftool "vsdiffmerge"]
keepbackup = false
[merge]
tool = vsdiffmerge
@drub0y
drub0y / install.log
Created April 22, 2016 22:54
Azure SDK 2.9 Install Failure on AzureTools.Notifications.msi
[141C:12A4][2016-04-22T15:48:46]i001: Burn v3.7.1224.0, Windows v6.2 (Build 9200: Service Pack 0), path: C:\Users\drub0\AppData\Local\Microsoft\Web Platform Installer\installers\WindowsAzureToolsOnlyVS2015BaseLocale.2.9\9D09A95A44450C409BC4F20B170635BAB9890151\MicrosoftAzureTools.VS140.exe, cmdline: '/quiet /norestart /log C:\Users\drub0\AppData\Local\Temp\WindowsAzureToolsVS2015_2_9_BaseLocale_Install.txt RUNDEVENVSETUP=0 -burn.unelevated BurnPipe.{9738F788-BE87-47BB-92CC-1939CA39524C} {DEE3715F-AECD-4961-B099-7B7AC3ABF13C} 9792'
[141C:12A4][2016-04-22T15:48:46]i000: Initializing string variable 'ProductShortName' to value 'Microsoft Azure Tools - v2.9'
[141C:12A4][2016-04-22T15:48:46]i000: Initializing string variable 'RUNDEVENVSETUP' to value '1'
[141C:12A4][2016-04-22T15:48:46]i000: Setting string variable 'WixBundleLog' to value 'C:\Users\drub0\AppData\Local\Temp\WindowsAzureToolsVS2015_2_9_BaseLocale_Install.txt'
[141C:12A4][2016-04-22T15:48:46]i000: Setting string variable 'WixBundleOriginalSource' to
@drub0y
drub0y / ActivityLog.xml
Created June 28, 2016 02:39
Visual Studio ActivityLog.xml showing package load failures after installing Update 3 RTM
<?xml version="1.0" encoding="utf-16"?>
<?xml-stylesheet type="text/xsl" href="ActivityLog.xsl"?>
<activity>
<entry>
<record>1</record>
<time>2016/06/28 02:06:41.136</time>
<type>Information</type>
<source>VisualStudio</source>
<description>Microsoft Visual Studio 2015 version: 14.0.25420.1</description>
</entry>