Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@bruno-garcia
bruno-garcia / AssemblyExtensions.cs
Last active April 14, 2018 15:02
Is .NET assembly optimized
using System.ComponentModel;
using System.Diagnostics;
using System.Reflection;
[EditorBrowsable(EditorBrowsableState.Never)]
internal static class AssemblyExtensions
{
/// <summary>
/// Whether the assembly was compiled with the optimize+ flag
/// </summary>
@bruno-garcia
bruno-garcia / ASP.NET Core middleware return Exception as text on response body
Created August 12, 2018 13:46
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)
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;
@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%
// Modifying root scope
Sentry.setTag("a","a");
// Creates a new scope and pushes in the stap, a clone of the previous one.
Sentry.pushScope();
// Here we have a tag a with value a
Sentry.setTag("a","b");
// Now a has value b
// Throw away the current scope (goes back to the previous item in the stack)
Sentry.popScope();
// Now tag a has value a
https://550e76353f1b41f7899e32875f22f08c@sentry.io/1512778
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;
https://github.com/Aminator/UwpWithoutVisualStudio
<PropertyGroup>
<TargetFrameworks>net5.0;netcoreapp3.0;netstandard2.1;netstandard2.0;net461</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(TargetFrameworks);net5.0-windows10.0.18362.0</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net5.0-windows10.0.18362.0'">
<!-- <TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>-->
<!-- <TargetPlatformMinVersion>10.0.18362.0</TargetPlatformMinVersion>-->

Installation

Create a Sentry module in <jboss-path>/modules/io/sentry/main/module.xml:

<?xml version='1.0' encoding='UTF-8'?>
<module xmlns="urn:jboss:module:1.1" name="io.sentry">
  <resources>
    <resource-root path="sentry-4.3.0.jar"/>
 
@bruno-garcia
bruno-garcia / enumerator-measure.cs
Created September 10, 2021 03:01
sentry measure IEnumerator
// measure enumeration:
//Where each enumeration is a result of a potentially coslty operation such as a DB cursor read
foreach (var group in groups.Measure())
{
// work
}
//Code: