Skip to content

Instantly share code, notes, and snippets.

@mtone
mtone / ThreadSafeOrganizationService.cs
Last active January 5, 2020 05:47
Thread-Safe OrganizationService
public class ThreadSafeOrganizationService : IOrganizationService {
private readonly object Locker = new object();
private readonly IOrganizationService _orgService;
/// <summary>
/// IOrganizationService wrapper to prevents integration tests from accessing the SDK in parallel.
/// </summary>
public ThreadSafeOrganizationService(IOrganizationService orgService) {
_orgService = orgService;
@mtone
mtone / OnBuildDebug.ps1
Created February 5, 2020 06:35
Add ExcludeFromCodeCoverage to generated code
Get-ChildItem ..\SomePath\ -Filter *.cs | Foreach-Object {
$filename = $_.FullName
# Add ExcludeFromCodeCoverage attribute in front of classes, if not already present
$found = Select-String -Path $filename -Pattern "System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage"
if ($found -eq $null) {
(Get-Content $fileName) |
Foreach-Object {
if ($_ -match "public partial class" -or $_ -match "internal sealed class") {
#Add before current line
// Imports here...
/**
* Rollup plugin that comments lines starting with "exports.xxx"
* This must be placed before minify/terser rollup plugins (and the reason it hooks on renderChunk instead of generateBundle)
*
* Related: https://github.com/rollup/rollup/issues/1893 (output.exports: "none" is not allowed using output.format: "cjs")
*/
const removeExportsPlugin = function () {
return {