Skip to content

Instantly share code, notes, and snippets.

Eli Arbel aelij

Block or report user

Report or block aelij

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
aelij / CryptoUtility.cs
Created Jul 30, 2018
Encrypt/decrypt Service Fabric secrets without the Fabric runtime
View CryptoUtility.cs
// Add NuGet "System.Security.Cryptography.Pkcs"
using System;
using System.Text;
using System.Security.Cryptography;
using System.Security.Cryptography.Pkcs;
using System.Security.Cryptography.X509Certificates;
namespace Security
aelij / RoslynReflection.cs
Last active Feb 4, 2019
Reflection using Roslyn (without loading assemblies into the app domain)
View RoslynReflection.cs
var compilation = CSharpCompilation.Create("C")
foreach (var type in
from assemblySymbol in compilation.SourceModule.ReferencedAssemblySymbols
from module in assemblySymbol.Modules
from n in module.GlobalNamespace.GetMembers()
where n.IsNamespace
from type in n.GetTypeMembers()
select type)
aelij /
Last active Jun 9, 2019
Deterministic Builds in C#

Deterministic Builds in C#


The C# compiler (Roslyn) supports deterministic builds since Visual Studio 2015. This means that compiling assemblies under the same conditions (permalink) would produce byte-for-byte equivalent binaries.

If you also intend on shipping non-portable (permalink)) PDBs, you must also make sure that paths in the PDBs are absolute using path mapping. The recommended way would be to map the enlistment (repo) root to a fixed path, such as C:\.

For more information, see this [blog post](

aelij / Create-ServiceFabricApplicationPackageSkeleton.ps1
Created Mar 9, 2017
Cmdlet to create a skeleton Service Fabric application package from the image store. Can be used for partial configuration/data packages upgrades.
View Create-ServiceFabricApplicationPackageSkeleton.ps1
function Create-ServiceFabricApplicationPackageSkeleton
[string] $ApplicationTypeName,
[string] $ApplicationTypeVersion,
aelij / Download-ServiceFabricImageStoreContent.ps1
Created Mar 9, 2017
Cmdlet that downloads files from Service Fabric's image store
View Download-ServiceFabricImageStoreContent.ps1
# Examples:
# List image store content:
# $connectionString = Get-ServiceFabricImageStoreConnectionString
# Get-ServiceFabricApplicationType | % { Get-ServiceFabricImageStoreContent -Application -ApplicationTypeName $_.ApplicationTypeName -ApplicationTypeVersion $_.ApplicationTypeVersion -ImageStoreConnectionString $connectionString }
# > StoreRelativePath : Store\Application1Type\Stateless1Pkg.Code.1.0.0
# > Type : Folder [5 files]
# > ServiceManifestName : Stateless1Pkg
# > ServiceManifestVersion : 1.0.0
# > ApplicationVersion : 1.0.0
View AsyncEnumerableGenerator.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Security;
using System.Threading;
using System.Threading.Tasks;
aelij / ThemeManager.cs
Created Jul 4, 2016
WPF Theme Manager
View ThemeManager.cs
using System;
using System.Reflection;
using System.Windows;
public static class ThemeManager
#region Fields
private const BindingFlags DefaultStaticFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static;
private const BindingFlags DefaultInstanceFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;
aelij / cs7-match.csx
Last active Apr 20, 2016
C# 7 Experiments for RoslynPad
View cs7-match.csx
abstract class Animal { }
class Dog : Animal
public string Bark() => "Woof";
class Cat : Animal
public string Meow() => "Meow";
aelij / -Usage.cs
Last active Apr 16, 2019
IAsyncEnumerable Bridge for Service Fabric Reliable Collections
View -Usage.cs
class MyService : StatefulService
private Task<IReliableDictionary<int, string>> AccountNames => StateManager.GetOrAddAsync<IReliableDictionary<int, string>>("AccountNames");
private Task<IReliableDictionary<int, string>> AccountData => StateManager.GetOrAddAsync<IReliableDictionary<int, string>>("AccountData");
public async Task<List<Account>> SearchAccountsByNameAsync(string name)
using (var txn = StateManager.CreateTransaction())
var accountNames = await AccountNames;
aelij / AsyncStackTrace.cs
Last active Feb 19, 2016
Improved async stack trace
View AsyncStackTrace.cs
// see the full featured library at
You can’t perform that action at this time.