Skip to content

Instantly share code, notes, and snippets.

@boekabart
boekabart / ValueTuple Case Conventions.cs
Created January 21, 2018 22:21
The Conflicting Case Of ValueTuple Casing Convention
public static class SomeXmlExtensions
{
/* Intentionally mixed up the two possible styles */
public (string name, string Value) FirstCustomProperty(this XElement element)
{
// See how up there, it looks like it should be like name, not like Value
var theName = ...;
var theValue = ...'
return (theName, theValue);
}
@boekabart
boekabart / xUnit-2-FluentAssertions.txt
Created January 17, 2018 23:30
Regex find/replace pairs to migrate many common xUnit Assertions to FluentAssertions syntax
Assert\.NotNull\((.*)\);
$1.Should().NotBeNull();
Assert\.Null\((.*)\);
$1.Should().BeNull();
Assert\.Equal\(\s*(\d+)\s*,\s*(.*)\.Length\);
$2.Should().HaveCount($1);
Assert\.Equal\(\s*([^,]+)\s*,\s*(.*)\s*\);
@boekabart
boekabart / CimPocAio_Combined.log
Created May 12, 2016 11:39
Akka.Net logging (combined from 2 log files) that shows that ClusterSingleton gets confused about who's oldest (A is oldest, but once B joins, A thinks B is oldest, and B thinks it's youngest).
A: ********** CimPocAiO logging started **********
A: 2016-05-10 21:25:19,810 INFO [6 ] DummyClassForStringSources Starting remoting
A: 2016-05-10 21:25:19,910 INFO [4 ] DummyClassForStringSources Remoting started; listening on addresses : [akka.tcp://CimPoc@127.0.0.1:9091]
A: 2016-05-10 21:25:19,910 INFO [5 ] DummyClassForStringSources Remoting now listens on addresses: [akka.tcp://CimPoc@127.0.0.1:9091]
A: 2016-05-10 21:25:19,946 INFO [7 ] DummyClassForStringSources Cluster Node [akka.tcp://CimPoc@127.0.0.1:9091] - Starting up...
A: 2016-05-10 21:25:19,964 WARN [7 ] ActorSystemImpl NewtonSoftJsonSerializer has been detected as a default serializer. It will be obsoleted in Akka.NET starting from version 1.5 in the favor of Wire (for more info visit: http://getakka.net/docs/Serialization#how-to-setup-wire-as-default-serializer ). If you want to suppress this message set HOCON `akka.suppress-json-serializer-warning` config flag to on.
A: 2016-05-10 21:25:19,964 WARN [4
@boekabart
boekabart / Singleton.log
Created January 26, 2016 21:02
Logging for ClusterSingleton not available issue
[DEBUG][26-1-2016 20:58:24][Thread 0008][EventStream] subscribing [akka://all-systems/] to channel Akka.Event.Info
[DEBUG][26-1-2016 20:58:24][Thread 0008][EventStream] subscribing [akka://all-systems/] to channel Akka.Event.Warning
[DEBUG][26-1-2016 20:58:24][Thread 0008][EventStream] subscribing [akka://all-systems/] to channel Akka.Event.Error
[DEBUG][26-1-2016 20:58:24][Thread 0008][EventStream] StandardOutLogger started
[DEBUG][26-1-2016 20:58:24][Thread 0011][akka://My/system] Started (Akka.Actor.SystemGuardianActor)
[DEBUG][26-1-2016 20:58:24][Thread 0013][akka://My/] Started (Akka.Actor.GuardianActor)
[DEBUG][26-1-2016 20:58:24][Thread 0010][akka://My/user] Started (Akka.Actor.GuardianActor)
[DEBUG][26-1-2016 20:58:24][Thread 0013][akka://My/] now supervising akka://My/user
[DEBUG][26-1-2016 20:58:24][Thread 0013][akka://My/] now supervising akka://My/system
[DEBUG][26-1-2016 20:58:24][Thread 0012][akka://My/user] now watched by [akka://My/system]
@boekabart
boekabart / @GithubCommanderActor.cs
Created April 16, 2015 21:42
Akka.Net await Ask<> within Receive<> deadlocks?
private void Ready()
{
Receive<CanAcceptJob>(AsyncBehavior.Suspend, async job =>
{
_coordinator.Tell(job);
await BecomeAsking();
});
}
private async Task BecomeAsking()