FODY

IL weaving for everyone

Paweł Łukasik

KGD.NET 19.03.2014

AGENDA


  • What's Fody?
  • What can be done?
  • Show me the code!
  • Our own example!

About.me


Reflection: 1492

Mono.Cecil: 1493

Solution?





Fody (ptak) -> wikłacze -> weaver -> IL weaver -> Fody (tool)

FODY?



Extensible tool for weaving .net assemblies.

The plumbing tasks Fody handles

  • Injection of the MSBuild task into the build pipeline
  • Resolving the location of the assembly and pdb
  • Abstracts the complexities of logging to MSBuild
  • Reads the assembly and pdb into the Mono.Cecil object model
  • Re-applying the strong name if necessary
  • Saving the assembly and pdb

Weaving??

Manipulating:

  • source code
  • IL instructions
  • JIT code

source: http://www.infoq.com/articles/Simon-Cropp

source: http://www.infoq.com/articles/Simon-Cropp

FODY




Add-INS




Anotar

logging




AssertMessage

assertions




AsyncErrorHandler

error handling to async and TPL code



Caseless

case-insensitive string comaprison



Catel

proprietary



Commander

ICommand properties from MVVM



Costura

references as resources



DependencyInjection

AutoFac, Ninject & Spring



EmptyConstructor

Adds empty ctor



EmptyStringGuard

checks from empty strings



EnableFaking

allows testing w/o writing interfaces



Equals

generates GetHashCode & Equals




ExtraConstraints



Fielder

converts fields to public properties



InfoOf

simillar to typeof for methods, properties and fields



Ionad

replaces static methods calls



Janitor

simplifies IDisposable



JetBrainsAnnotations

proprietary



MethodCache

Caches return value of methods



MethodDecorator

Add code to be executed before and after invocation 





MethodTimer

method timing code




Mixins



ModuleInit

Module initializer of an assembly



Mutable

F# adding for union type setters



NullGuard

checks for null arguments



Obsolete

Helps keeps ObsoleteAttribute consistent



PropertyChanged

INotifyPropertyChanged



PropertyChanging

INotifyPropertyChanging



Publicize

Non-public to public



RemoveReference

self-explanatory



Resourcer

simple reading of resources



Scalpel

removes tests




Spring



Stamp

Adds git info to assembly




StampSvn

Same but with SVN



Stiletto

proprietary



ToString

ToString from public properties



Usable

enclose all IDisposable variables with using



Validar

IDataErrorInfo & INotifyDataErrorInfo



Visualize

DebuggerVisualizer




Virtuosity

change all members to virtual


DEMO

Fody in Action



DEMO: CREATE YOUR OWN ADDIN


FODY

+

EncRYPT

.Sum()

    We've showed:

    • how to use Fody'iego
    • it's features
    • jak tworzyć własne AddIn'y

    Knowledge - WHERE?


    Questions?

    Feedback:

    twitter: @pawel_lukasik

    mail: pawel@octal.pl

    blog: http://blog.octal.pl



    THANK YOU!

    http://slid.es/pawellukasik/fody

    http://blog.octal.pl

    Made with Slides.com