Skip to content

Instantly share code, notes, and snippets.

@skolima
skolima / gist:3736634
Created September 17, 2012 10:37
DisposableFieldsShouldBeDisposedRule gives false positives on generic classes
diff --git a/gendarme/rules/Gendarme.Rules.Correctness/Test/DisposableFieldsShouldBeDisposedTest.cs b/gendarme/rules/Gendarme.Rules.Correctness/Test/DisposableFieldsShouldBeDisposedTest.cs
index 7ff3543..3f049e9 100644
--- a/gendarme/rules/Gendarme.Rules.Correctness/Test/DisposableFieldsShouldBeDisposedTest.cs
+++ b/gendarme/rules/Gendarme.Rules.Correctness/Test/DisposableFieldsShouldBeDisposedTest.cs
@@ -30,6 +30,7 @@
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
@skolima
skolima / JobObject.cs
Created September 30, 2012 21:07
JobObject
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace JobObjectSpike
{
internal sealed class JobObject : IDisposable
{
private readonly IntPtr _jobObjectHandle;
@skolima
skolima / keybase.md
Last active September 12, 2019 07:41

Keybase proof

I hereby claim:

  • I am skolima on github.
  • I am skolima (https://keybase.io/skolima) on keybase.
  • I have a public key ASA_cfIuSKZt9qKX1oNj3oUFu9RZjyvU-29je0blhI_5GQo

To claim this, I am signing this object:

using System;
using System.IO;
using System.Linq;
using Amazon;
using Amazon.S3;
using Amazon.S3.Model;
namespace GetAmazonBucketContents
{
// uses AWSSDK NuGet package
10-07 21:28:55.858 1915 3327 I ActivityManager: Start proc 27228:com.grazerss/u0a95 for activity com.grazerss/.DashboardListActivity
10-07 21:28:55.971 2568 2568 V PhoneStatusBar: setLightsOn(true)
10-07 21:28:55.975 27228 27228 W System : ClassLoader referenced unknown path: /data/app/com.grazerss-1/lib/arm
10-07 21:28:55.979 2915 3036 E Surface : getSlotFromBufferLocked: unknown buffer: 0x972f8260
10-07 21:28:56.058 27228 27228 D com.grazerss.AssetContentProvider: onCreate()
10-07 21:28:56.098 27228 27228 W NewsRob : No debug properties loaded.
10-07 21:28:56.161 27228 27228 D com.grazerss.storage.SdCardStorageAdapter: setupMedium status=mounted mounted false->true, read-only false->false, shared false -> false.
10-07 21:28:56.195 27228 27228 D NewsRob : NewsRob.onCreate()
10-07 21:28:56.210 27228 27228 D NewsRob : NewsRob Default Exception handler installed already? false
10-07 21:28:56.210 27228 27228 D NewsRobDefaultExceptionHandler: Default Exception Handler=com.android.internal.os.RuntimeInit$Un
@skolima
skolima / Sample.resx
Last active April 9, 2018 16:08
Empty resx as generated by VS 2017
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
@skolima
skolima / ProjectWithResx.csproj
Created April 19, 2018 10:01
Automatically updating translation .Designer.cs files on build when .resx changes
<Project><!-- all the other bits removed -->
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- add this as part of your BeforeBuild target -->
<Target Name="BeforeBuild">
<ItemGroup>
<ResXCodeSources Include=".\defaultResourceFile.resx" />
<ResXCodeSources Include=".\anotherDefaultTranslation.resx" />
<ResXCodeSources Include=".\youGetTheIdea.resx" />
</ItemGroup>
<MakeDir Directories=".\bin\Debug\" />
@skolima
skolima / Program.cs
Last active April 30, 2018 08:26
ServicePointManager.SecurityProtocol defaults on various .NET versions
using System;
using System.Net;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("ServicePointManager.SecurityProtocol, default after startup");
namespace System.Collections.Generic
{
using Collections;
using Linq;
public static class EnumerableExtension
{
public static IEnumerable EmptyIfNull(this IEnumerable enumerable) => enumerable ?? Enumerable.Empty<object>();
public static IEnumerable<T> EmptyIfNull<T>(this IEnumerable<T> enumerable) => enumerable ?? Enumerable.Empty<T>();