Skip to content

Instantly share code, notes, and snippets.

Bruno Garcia bruno-garcia

View GitHub Profile
View FileAppenderDiagnosticLogger
using System;
using System.Globalization;
using System.IO;
using Sentry.Extensibility;
using Sentry.Protocol;
public class FileAppenderDiagnosticLogger : IDiagnosticLogger
private readonly SentryLevel _minimalLevel;
private readonly StreamWriter _writer;
View UE4 DSN
View Sentry scope JS
// Modifying root scope
// Creates a new scope and pushes in the stap, a clone of the previous one.
// Here we have a tag a with value a
// Now a has value b
// Throw away the current scope (goes back to the previous item in the stack)
// Now tag a has value a
bruno-garcia / link.xml
Created Oct 8, 2018
link.xml for Unity IL2CPP to work with Newtonsoft.Json (Tested with the Sentry SDK
View link.xml
bruno-garcia / ASP.NET Core middleware return Exception as text on response body
Created Aug 12, 2018
ASP.NET Core middleware which return Exception as text on response body (useful when using swagger UI to test API in development instead of default HTML view)
View ASP.NET Core middleware return Exception as text on response body
using System;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Diagnostics;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
internal class ExceptionInResponseMiddleware
private readonly RequestDelegate _next;
View vs
@echo off
for /f %%a in ('dir /b *.sln 2^> nul') do set sln=%%a
if defined sln set sln=%cd%\%sln%
start "" /b "C:\Program Files (x86)\Microsoft Visual Studio\Preview\Community\Common7\IDE\devenv.exe" %sln%
bruno-garcia / AssemblyExtensions.cs
Last active Apr 14, 2018
Is .NET assembly optimized
View AssemblyExtensions.cs
using System.ComponentModel;
using System.Diagnostics;
using System.Reflection;
internal static class AssemblyExtensions
/// <summary>
/// Whether the assembly was compiled with the optimize+ flag
/// </summary>

Keybase proof

I hereby claim:

  • I am bruno-garcia on github.
  • I am brunogarcia ( on keybase.
  • I have a public key ASCwN-0tPUXeUT287EntKXJ-lI2FFSi3bJ9EZS-LDMce_Ao

To claim this, I am signing this object:

View FollowRefReturn.cs
class Program
static void Main()
var a = 1;
ref var b = ref Increment(ref a);
var c = Increment(ref b);
System.Console.WriteLine($@"a: {a}
View fixed span on func by using action and ignoring arg.cs
public void Serialize_NullObject_ThrowsNullArgument()
var sut = new MessagePackSerializer(new MessagePackOptions());
Assert.Throws<ArgumentNullException>(() => { sut.Serialize((object) null); });
You can’t perform that action at this time.