Fork me on GitHub

Project Notes

#020 Explainer - C# Version

This sample implements a C# version of the Explainer Protocol.

The Explainer is totally inspired by Natalie Silvanovich’s Hardware Excuse Generator

Generate Protocol Stubs

This generates the Explainer.cs ExplainerGrpc.cs protocol implementation and stubs.

$ protoc -I ../protocols --csharp_out=./explain --grpc_out=. --plugin=protoc-gen-grpc=`which grpc_csharp_plugin` ../protocols/explainer.proto

Build

I’m building this on MacOS with mono 4.2.3

$ mono --version
Mono JIT compiler version 4.2.3 (explicit/832de4b Thu Mar  3 19:24:57 EST 2016)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
  TLS:           normal
  SIGSEGV:       altstack
  Notification:  kqueue
  Architecture:  x86
  Disabled:      none
  Misc:          softdebug
  LLVM:          yes(3.6.0svn-mono-(detached/a173357)
  GC:            sgen

The project was setup with Xamarin Studio. Open the explain/explain.sln solution and build the project. It should also be possible to build it without issues on Windows with Visual Studio.

Alternatively, it can be built from the command line:

$ cd explain
$ bin/nuget install ./packages.config -OutputDirectory ./packages
[...etc till done...]
$ xbuild /p:Configuration=Release explain.sln

Test Drive - C# Client

I don’t have a c# server implementation yet, so using the ruby version Start the server in one console window..

$ cd ../ruby
$ ./explainer.rb
ShiFu is waiting to explain all of your problems...

Now try the c# client in another:

$ cd explain
$ mono bin/Release/explain.exe

Here's some help:

Describe your problem in a sentence, using the text "REASON" where-ever you'd like a good excuse inserted

e.g. "Glitching was not a viable attack because of REASON"

$ mono bin/Release/explain.exe "Your phone is probably crashing because of REASON"
Your phone is probably crashing because of a lack of shielding against alpha radiation (cosmic rays) in button
$ mono bin/Release/explain.exe "Your phone is probably crashing because of REASON"
Your phone is probably crashing because of stray harmonics
$ mono bin/Release/explain.exe "Your phone is probably crashing because of REASON"
Your phone is probably crashing because of thermal effects in the pull-up resistor
$ mono bin/Release/explain.exe "Your phone is probably crashing because of REASON"
Your phone is probably crashing because of pull-up resistor being placed too close to pull-up resistor on the PCB
$ mono bin/Release/explain.exe "Your phone is probably crashing because of REASON"
Your phone is probably crashing because of voltage gitches in the battery

Credits and References

About LCK#20 gRPCC#Messaging

This page is a web-friendly rendering of my project notes shared in the LittleCodingKata GitHub repository.

Project Source on GitHub Return to the LittleCodingKata Catalog
About LittleCodingKata

LittleCodingKata is my collection of programming exercises, research and code toys broadly spanning things that relate to programming and software development (languages, frameworks and tools).

These range from the trivial to the complex and serious. Many are inspired by existing work and I'll note credits and references where applicable. The focus is quite scattered, as I variously work on things new and important in the moment, or go back to revisit things from the past.

This is primarily a personal collection for my own edification and learning, but anyone who stumbles by is welcome to borrow, steal or reference the work here. And if you spot errors or issues I'd really appreciate some feedback - create an issue, send me an email or even send a pull-request.

Follow the Blog follow projects and notes as they are published in your favourite feed reader