SlideShare a Scribd company logo
{{
FodyFody
code weaving made funcode weaving made fun
About meAbout me
 Tomasz PluskiewiczTomasz Pluskiewicz
 WrocławWrocław
 MakoLab S.A.MakoLab S.A.
 @tpluscode@tpluscode
 About code weavingAbout code weaving
 About FodyAbout Fody
 ExamplesExamples
 QuestionsQuestions
AgendaAgenda
„„Generate” additional code to:Generate” additional code to:
 Add boilerplate code automaticallyAdd boilerplate code automatically
 Implement Aspect-Oriented ProgrammingImplement Aspect-Oriented Programming
 ObfuscationObfuscation
 Build killer APIsBuild killer APIs
What is code weaving?What is code weaving?
 Source code weavingSource code weaving
 Compile-time weavingCompile-time weaving
 Runtime weavingRuntime weaving
How can I weave?How can I weave?
 Emitting MSILEmitting MSIL
 Refelction.EmitRefelction.Emit
 Mono.CecilMono.Cecil
 Dynamic proxiesDynamic proxies
 Castle, LinFu, Unity, Impromptu InterfaceCastle, LinFu, Unity, Impromptu Interface
 AOPAOP
 PostSharp, AfterthoughtPostSharp, Afterthought
 RoslynRoslyn
The toolsThe tools
 Simple but less flexibileSimple but less flexibile
 Requires runtime reference to PostSharpRequires runtime reference to PostSharp
 Requires Visual Studio extensionRequires Visual Studio extension
 Aspects in embedded resourcesAspects in embedded resources
 Full functionality is not freeFull functionality is not free
PostSharpPostSharp
IL weaving (with Cecil)IL weaving (with Cecil)
 ILIL isis difficultdifficult
 Need to update PDBsNeed to update PDBs
 MSBuild integrationMSBuild integration
Fodies are small passerine
birds belonging to the genus
Foudia in the weaver family
Ploceidae
- wikipedia/Fody
WeaverWeaver
CodeCode
 Many pre-built weaversMany pre-built weavers
 Uses Mono.CecilUses Mono.Cecil
 Integrates into build processIntegrates into build process
 Works on build serversWorks on build servers
 Leaves no referencesLeaves no references
 Well… depending on the pluginWell… depending on the plugin
 Versatile:Versatile:
 .NET 3.5-4.5.NET 3.5-4.5
 Silverlight 4 & 5Silverlight 4 & 5
 Mono, MonoTouch, MonoDroidMono, MonoTouch, MonoDroid
 Windows Phone 7 & 8 (also Metro)Windows Phone 7 & 8 (also Metro)
 Portable Class LibraryPortable Class Library
FodyFody
 Almost 70 packages on NuGetAlmost 70 packages on NuGet
 NullGuardNullGuard
 PropertyChangedPropertyChanged
 CosturaCostura
 AnotarAnotar
 ModuleInitModuleInit
 FreezableFreezable
 MethodDecoratorMethodDecorator
 InfoOfInfoOf
 ToStringToString
Community weaversCommunity weavers
DemoDemo
 Emitting IL is still required (duh!)Emitting IL is still required (duh!)
 However FodyHowever Fody
 Injects weavers to build pipelineInjects weavers to build pipeline
 Loads assembliesLoads assemblies
 Rewrites PDBsRewrites PDBs
 Reapplies strong nameReapplies strong name
 Writes to MSBuild build logWrites to MSBuild build log
Custom weavingCustom weaving
 Assembly with .Fody suffixAssembly with .Fody suffix
 ILMerge referencesILMerge references
 Pulic ModuleWeaver classPulic ModuleWeaver class
 Mutltiple deployment optionsMutltiple deployment options
 In-solutionIn-solution
 $(SolutionDir)/Tools
 NuGet packageNuGet package
 Learn fromLearn from
 existing weavers (example follows)existing weavers (example follows)
 Fody wikiFody wiki
Writing a weaverWriting a weaver
DemoDemo
 Don’t use Visual Studio pluginDon’t use Visual Studio plugin
 Weaver order sometimes does matterWeaver order sometimes does matter
 Debugging unavailable codeDebugging unavailable code

 LogInfo requires detailed MSBuild outputLogInfo requires detailed MSBuild output
 Tools -> Projects and Solutions -> Build andTools -> Projects and Solutions -> Build and
RunRun
 Remember to update Fody packageRemember to update Fody package
GotchasGotchas
 https://github.com/Fody/https://github.com/Fody/
 https://github.com/Fody/Fody/wiki/HowToWriteAnAddinhttps://github.com/Fody/Fody/wiki/HowToWriteAnAddin
 https://github.com/Fody/Fody/wiki/ModuleWeaverhttps://github.com/Fody/Fody/wiki/ModuleWeaver
 https://github.com/Fody/Fody/wiki/DeployingAddinsAsNugetshttps://github.com/Fody/Fody/wiki/DeployingAddinsAsNugets
 http://www.planetgeek.ch/2013/08/31/dont-wear-woven-sweatshirts-instead-weave-your-http://www.planetgeek.ch/2013/08/31/dont-wear-woven-sweatshirts-instead-weave-your-
assemblies/assemblies/
 http://haacked.com/archive/2013/01/04/mitigate-the-billion-dollar-mistake-with-aspects.aspx/http://haacked.com/archive/2013/01/04/mitigate-the-billion-dollar-mistake-with-aspects.aspx/
LinksLinks
Questions?Questions?
The end – wake up nowThe end – wake up now 

More Related Content

Viewers also liked

Catalogo general general electric geit 10012 en-rev6_final
Catalogo general general electric geit 10012 en-rev6_finalCatalogo general general electric geit 10012 en-rev6_final
Catalogo general general electric geit 10012 en-rev6_finalPablo Bavarisco
 
Colaboración entre familias, escuela y entorno. Las gafitas de Andreita.
Colaboración entre familias, escuela y entorno. Las gafitas de Andreita. Colaboración entre familias, escuela y entorno. Las gafitas de Andreita.
Colaboración entre familias, escuela y entorno. Las gafitas de Andreita.
Juani Martinez Nuñez
 
Laminas cap6
Laminas cap6Laminas cap6
Laminas cap6
meriam alaoui ismaili
 
el colibri
el colibriel colibri
el colibri
villelmora
 
Www bizcommunity com_company_view_thedoanlawfirmp_c
Www bizcommunity com_company_view_thedoanlawfirmp_cWww bizcommunity com_company_view_thedoanlawfirmp_c
Www bizcommunity com_company_view_thedoanlawfirmp_c
AshamedCent199
 
ES145 01-Especial Perfumes-Top Expresiones de Compra
ES145 01-Especial Perfumes-Top Expresiones de CompraES145 01-Especial Perfumes-Top Expresiones de Compra
ES145 01-Especial Perfumes-Top Expresiones de Compra
Bint
 
Simulacro de examen lengua y literatura
Simulacro de examen lengua y literaturaSimulacro de examen lengua y literatura
Simulacro de examen lengua y literaturaAnicu12
 
Los terremotos ppts
Los terremotos pptsLos terremotos ppts
Los terremotos ppts
Isabel Lozano
 
Dominio internet
Dominio internetDominio internet
Dominio internet
Geovypg
 
Articulo estrategias para lidiar con el acoso moral en las empresas
Articulo estrategias para lidiar con el acoso moral en las empresasArticulo estrategias para lidiar con el acoso moral en las empresas
Articulo estrategias para lidiar con el acoso moral en las empresas
kristinamorales
 
Guía psicología laboral ii modificada lic. leyden lopez
Guía  psicología laboral ii modificada lic. leyden lopezGuía  psicología laboral ii modificada lic. leyden lopez
Guía psicología laboral ii modificada lic. leyden lopez
Mauricio Castro
 
Robots in Human Environments
Robots in Human EnvironmentsRobots in Human Environments
Robots in Human Environments
Andreas Heil
 
happytal recrute !! Stage concierge hopital
happytal recrute !! Stage concierge hopitalhappytal recrute !! Stage concierge hopital
happytal recrute !! Stage concierge hopital
Romain Revellat
 
Dudley CCG Think Kidneys Update
Dudley CCG Think Kidneys UpdateDudley CCG Think Kidneys Update
Dudley CCG Think Kidneys Update
Renal Association
 
Why Semantic Knowledge Graphs matter
Why Semantic Knowledge Graphs matterWhy Semantic Knowledge Graphs matter
Why Semantic Knowledge Graphs matter
Andreas Blumauer
 
2014 artwork contest results
2014 artwork contest results2014 artwork contest results
2014 artwork contest results
happylily1116
 
TECNOLOGIA DE MICROONDAS
 TECNOLOGIA DE MICROONDAS  TECNOLOGIA DE MICROONDAS
TECNOLOGIA DE MICROONDAS
Medwaves
 

Viewers also liked (18)

Catalogo general general electric geit 10012 en-rev6_final
Catalogo general general electric geit 10012 en-rev6_finalCatalogo general general electric geit 10012 en-rev6_final
Catalogo general general electric geit 10012 en-rev6_final
 
Colaboración entre familias, escuela y entorno. Las gafitas de Andreita.
Colaboración entre familias, escuela y entorno. Las gafitas de Andreita. Colaboración entre familias, escuela y entorno. Las gafitas de Andreita.
Colaboración entre familias, escuela y entorno. Las gafitas de Andreita.
 
Laminas cap6
Laminas cap6Laminas cap6
Laminas cap6
 
el colibri
el colibriel colibri
el colibri
 
Www bizcommunity com_company_view_thedoanlawfirmp_c
Www bizcommunity com_company_view_thedoanlawfirmp_cWww bizcommunity com_company_view_thedoanlawfirmp_c
Www bizcommunity com_company_view_thedoanlawfirmp_c
 
ES145 01-Especial Perfumes-Top Expresiones de Compra
ES145 01-Especial Perfumes-Top Expresiones de CompraES145 01-Especial Perfumes-Top Expresiones de Compra
ES145 01-Especial Perfumes-Top Expresiones de Compra
 
Simulacro de examen lengua y literatura
Simulacro de examen lengua y literaturaSimulacro de examen lengua y literatura
Simulacro de examen lengua y literatura
 
Los terremotos ppts
Los terremotos pptsLos terremotos ppts
Los terremotos ppts
 
Dominio internet
Dominio internetDominio internet
Dominio internet
 
Articulo estrategias para lidiar con el acoso moral en las empresas
Articulo estrategias para lidiar con el acoso moral en las empresasArticulo estrategias para lidiar con el acoso moral en las empresas
Articulo estrategias para lidiar con el acoso moral en las empresas
 
Guía psicología laboral ii modificada lic. leyden lopez
Guía  psicología laboral ii modificada lic. leyden lopezGuía  psicología laboral ii modificada lic. leyden lopez
Guía psicología laboral ii modificada lic. leyden lopez
 
Robots in Human Environments
Robots in Human EnvironmentsRobots in Human Environments
Robots in Human Environments
 
happytal recrute !! Stage concierge hopital
happytal recrute !! Stage concierge hopitalhappytal recrute !! Stage concierge hopital
happytal recrute !! Stage concierge hopital
 
Dudley CCG Think Kidneys Update
Dudley CCG Think Kidneys UpdateDudley CCG Think Kidneys Update
Dudley CCG Think Kidneys Update
 
Why Semantic Knowledge Graphs matter
Why Semantic Knowledge Graphs matterWhy Semantic Knowledge Graphs matter
Why Semantic Knowledge Graphs matter
 
2014 artwork contest results
2014 artwork contest results2014 artwork contest results
2014 artwork contest results
 
TECNOLOGIA DE MICROONDAS
 TECNOLOGIA DE MICROONDAS  TECNOLOGIA DE MICROONDAS
TECNOLOGIA DE MICROONDAS
 
La optica
La opticaLa optica
La optica
 

Similar to Fody - code weaving made fun

From printed circuit boards to exploits
From printed circuit boards to exploitsFrom printed circuit boards to exploits
From printed circuit boards to exploits
virtualabs
 
ITB2019 CommandBox vs Node.js - Nolan Erck
ITB2019  CommandBox vs Node.js - Nolan ErckITB2019  CommandBox vs Node.js - Nolan Erck
ITB2019 CommandBox vs Node.js - Nolan Erck
Ortus Solutions, Corp
 
JavaOne 2015 : How I Rediscovered My Coding Mojo by Building an IoT/Robotics ...
JavaOne 2015 : How I Rediscovered My Coding Mojo by Building an IoT/Robotics ...JavaOne 2015 : How I Rediscovered My Coding Mojo by Building an IoT/Robotics ...
JavaOne 2015 : How I Rediscovered My Coding Mojo by Building an IoT/Robotics ...
Mark West
 
IronRuby for the Rubyist
IronRuby for the RubyistIronRuby for the Rubyist
IronRuby for the Rubyist
Will Green
 
Windows: Having its ass kicked by Puppet and Powershell since 2012 #PuppetConf
Windows: Having its ass kicked by Puppet and Powershell since 2012 #PuppetConfWindows: Having its ass kicked by Puppet and Powershell since 2012 #PuppetConf
Windows: Having its ass kicked by Puppet and Powershell since 2012 #PuppetConfPaul Stack
 
Why Have The Specifications Been Based On Java™ Technology? - P Kriens
Why Have The Specifications Been Based On Java™ Technology? - P KriensWhy Have The Specifications Been Based On Java™ Technology? - P Kriens
Why Have The Specifications Been Based On Java™ Technology? - P Kriens
mfrancis
 
Web of Technologies Again
Web of Technologies AgainWeb of Technologies Again
Web of Technologies Again
dynamis
 
Mono for Android?
Mono for Android?Mono for Android?
Mono for Android?
Kevin McMahon
 
Modular JavaScript in an OSGi World - S Mak
Modular JavaScript in an OSGi World - S MakModular JavaScript in an OSGi World - S Mak
Modular JavaScript in an OSGi World - S Mak
mfrancis
 
Taking The Cloud Native
Taking The Cloud NativeTaking The Cloud Native
Taking The Cloud Native
Corey Clark, Ph.D.
 
Cloudbusting 2012: All out on the cloud
Cloudbusting 2012: All out on the cloudCloudbusting 2012: All out on the cloud
Cloudbusting 2012: All out on the cloud
Jan Jongboom
 
Javaone2008 Bof 5102 Groovybuilders
Javaone2008 Bof 5102 GroovybuildersJavaone2008 Bof 5102 Groovybuilders
Javaone2008 Bof 5102 Groovybuilders
Andres Almiray
 
Bringing The Sexy Back To WebWorkers
Bringing The Sexy Back To WebWorkersBringing The Sexy Back To WebWorkers
Bringing The Sexy Back To WebWorkers
Corey Clark, Ph.D.
 
XSS Without Browser
XSS Without BrowserXSS Without Browser
XSS Without Browser
kosborn
 
JVM Bytecodes
JVM BytecodesJVM Bytecodes
JVM Bytecodes
Anvay Patil
 
Devoxx France 2013 Cloud Best Practices
Devoxx France 2013 Cloud Best PracticesDevoxx France 2013 Cloud Best Practices
Devoxx France 2013 Cloud Best PracticesEric Bottard
 
Find your own iOS kernel bug
Find your own iOS kernel bugFind your own iOS kernel bug
Find your own iOS kernel bug
Gustavo Martinez
 
英文【Xu hao chen xiaobo】find your_own_ios_kernel_bug
英文【Xu hao chen xiaobo】find your_own_ios_kernel_bug英文【Xu hao chen xiaobo】find your_own_ios_kernel_bug
英文【Xu hao chen xiaobo】find your_own_ios_kernel_bugWang Hao Lee
 
Turbo charging v8 engine
Turbo charging v8 engineTurbo charging v8 engine
Turbo charging v8 engine
Hyderabad Scalability Meetup
 
Reusando componentes Zope fuera de Zope
Reusando componentes Zope fuera de ZopeReusando componentes Zope fuera de Zope
Reusando componentes Zope fuera de Zope
menttes
 

Similar to Fody - code weaving made fun (20)

From printed circuit boards to exploits
From printed circuit boards to exploitsFrom printed circuit boards to exploits
From printed circuit boards to exploits
 
ITB2019 CommandBox vs Node.js - Nolan Erck
ITB2019  CommandBox vs Node.js - Nolan ErckITB2019  CommandBox vs Node.js - Nolan Erck
ITB2019 CommandBox vs Node.js - Nolan Erck
 
JavaOne 2015 : How I Rediscovered My Coding Mojo by Building an IoT/Robotics ...
JavaOne 2015 : How I Rediscovered My Coding Mojo by Building an IoT/Robotics ...JavaOne 2015 : How I Rediscovered My Coding Mojo by Building an IoT/Robotics ...
JavaOne 2015 : How I Rediscovered My Coding Mojo by Building an IoT/Robotics ...
 
IronRuby for the Rubyist
IronRuby for the RubyistIronRuby for the Rubyist
IronRuby for the Rubyist
 
Windows: Having its ass kicked by Puppet and Powershell since 2012 #PuppetConf
Windows: Having its ass kicked by Puppet and Powershell since 2012 #PuppetConfWindows: Having its ass kicked by Puppet and Powershell since 2012 #PuppetConf
Windows: Having its ass kicked by Puppet and Powershell since 2012 #PuppetConf
 
Why Have The Specifications Been Based On Java™ Technology? - P Kriens
Why Have The Specifications Been Based On Java™ Technology? - P KriensWhy Have The Specifications Been Based On Java™ Technology? - P Kriens
Why Have The Specifications Been Based On Java™ Technology? - P Kriens
 
Web of Technologies Again
Web of Technologies AgainWeb of Technologies Again
Web of Technologies Again
 
Mono for Android?
Mono for Android?Mono for Android?
Mono for Android?
 
Modular JavaScript in an OSGi World - S Mak
Modular JavaScript in an OSGi World - S MakModular JavaScript in an OSGi World - S Mak
Modular JavaScript in an OSGi World - S Mak
 
Taking The Cloud Native
Taking The Cloud NativeTaking The Cloud Native
Taking The Cloud Native
 
Cloudbusting 2012: All out on the cloud
Cloudbusting 2012: All out on the cloudCloudbusting 2012: All out on the cloud
Cloudbusting 2012: All out on the cloud
 
Javaone2008 Bof 5102 Groovybuilders
Javaone2008 Bof 5102 GroovybuildersJavaone2008 Bof 5102 Groovybuilders
Javaone2008 Bof 5102 Groovybuilders
 
Bringing The Sexy Back To WebWorkers
Bringing The Sexy Back To WebWorkersBringing The Sexy Back To WebWorkers
Bringing The Sexy Back To WebWorkers
 
XSS Without Browser
XSS Without BrowserXSS Without Browser
XSS Without Browser
 
JVM Bytecodes
JVM BytecodesJVM Bytecodes
JVM Bytecodes
 
Devoxx France 2013 Cloud Best Practices
Devoxx France 2013 Cloud Best PracticesDevoxx France 2013 Cloud Best Practices
Devoxx France 2013 Cloud Best Practices
 
Find your own iOS kernel bug
Find your own iOS kernel bugFind your own iOS kernel bug
Find your own iOS kernel bug
 
英文【Xu hao chen xiaobo】find your_own_ios_kernel_bug
英文【Xu hao chen xiaobo】find your_own_ios_kernel_bug英文【Xu hao chen xiaobo】find your_own_ios_kernel_bug
英文【Xu hao chen xiaobo】find your_own_ios_kernel_bug
 
Turbo charging v8 engine
Turbo charging v8 engineTurbo charging v8 engine
Turbo charging v8 engine
 
Reusando componentes Zope fuera de Zope
Reusando componentes Zope fuera de ZopeReusando componentes Zope fuera de Zope
Reusando componentes Zope fuera de Zope
 

Recently uploaded

GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 

Recently uploaded (20)

GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 

Fody - code weaving made fun

  • 1. {{ FodyFody code weaving made funcode weaving made fun
  • 2. About meAbout me  Tomasz PluskiewiczTomasz Pluskiewicz  WrocławWrocław  MakoLab S.A.MakoLab S.A.  @tpluscode@tpluscode
  • 3.  About code weavingAbout code weaving  About FodyAbout Fody  ExamplesExamples  QuestionsQuestions AgendaAgenda
  • 4. „„Generate” additional code to:Generate” additional code to:  Add boilerplate code automaticallyAdd boilerplate code automatically  Implement Aspect-Oriented ProgrammingImplement Aspect-Oriented Programming  ObfuscationObfuscation  Build killer APIsBuild killer APIs What is code weaving?What is code weaving?
  • 5.  Source code weavingSource code weaving  Compile-time weavingCompile-time weaving  Runtime weavingRuntime weaving How can I weave?How can I weave?
  • 6.  Emitting MSILEmitting MSIL  Refelction.EmitRefelction.Emit  Mono.CecilMono.Cecil  Dynamic proxiesDynamic proxies  Castle, LinFu, Unity, Impromptu InterfaceCastle, LinFu, Unity, Impromptu Interface  AOPAOP  PostSharp, AfterthoughtPostSharp, Afterthought  RoslynRoslyn The toolsThe tools
  • 7.  Simple but less flexibileSimple but less flexibile  Requires runtime reference to PostSharpRequires runtime reference to PostSharp  Requires Visual Studio extensionRequires Visual Studio extension  Aspects in embedded resourcesAspects in embedded resources  Full functionality is not freeFull functionality is not free PostSharpPostSharp
  • 8. IL weaving (with Cecil)IL weaving (with Cecil)  ILIL isis difficultdifficult  Need to update PDBsNeed to update PDBs  MSBuild integrationMSBuild integration
  • 9. Fodies are small passerine birds belonging to the genus Foudia in the weaver family Ploceidae - wikipedia/Fody
  • 11.  Many pre-built weaversMany pre-built weavers  Uses Mono.CecilUses Mono.Cecil  Integrates into build processIntegrates into build process  Works on build serversWorks on build servers  Leaves no referencesLeaves no references  Well… depending on the pluginWell… depending on the plugin  Versatile:Versatile:  .NET 3.5-4.5.NET 3.5-4.5  Silverlight 4 & 5Silverlight 4 & 5  Mono, MonoTouch, MonoDroidMono, MonoTouch, MonoDroid  Windows Phone 7 & 8 (also Metro)Windows Phone 7 & 8 (also Metro)  Portable Class LibraryPortable Class Library FodyFody
  • 12.  Almost 70 packages on NuGetAlmost 70 packages on NuGet  NullGuardNullGuard  PropertyChangedPropertyChanged  CosturaCostura  AnotarAnotar  ModuleInitModuleInit  FreezableFreezable  MethodDecoratorMethodDecorator  InfoOfInfoOf  ToStringToString Community weaversCommunity weavers
  • 14.  Emitting IL is still required (duh!)Emitting IL is still required (duh!)  However FodyHowever Fody  Injects weavers to build pipelineInjects weavers to build pipeline  Loads assembliesLoads assemblies  Rewrites PDBsRewrites PDBs  Reapplies strong nameReapplies strong name  Writes to MSBuild build logWrites to MSBuild build log Custom weavingCustom weaving
  • 15.  Assembly with .Fody suffixAssembly with .Fody suffix  ILMerge referencesILMerge references  Pulic ModuleWeaver classPulic ModuleWeaver class  Mutltiple deployment optionsMutltiple deployment options  In-solutionIn-solution  $(SolutionDir)/Tools  NuGet packageNuGet package  Learn fromLearn from  existing weavers (example follows)existing weavers (example follows)  Fody wikiFody wiki Writing a weaverWriting a weaver
  • 17.  Don’t use Visual Studio pluginDon’t use Visual Studio plugin  Weaver order sometimes does matterWeaver order sometimes does matter  Debugging unavailable codeDebugging unavailable code   LogInfo requires detailed MSBuild outputLogInfo requires detailed MSBuild output  Tools -> Projects and Solutions -> Build andTools -> Projects and Solutions -> Build and RunRun  Remember to update Fody packageRemember to update Fody package GotchasGotchas
  • 18.  https://github.com/Fody/https://github.com/Fody/  https://github.com/Fody/Fody/wiki/HowToWriteAnAddinhttps://github.com/Fody/Fody/wiki/HowToWriteAnAddin  https://github.com/Fody/Fody/wiki/ModuleWeaverhttps://github.com/Fody/Fody/wiki/ModuleWeaver  https://github.com/Fody/Fody/wiki/DeployingAddinsAsNugetshttps://github.com/Fody/Fody/wiki/DeployingAddinsAsNugets  http://www.planetgeek.ch/2013/08/31/dont-wear-woven-sweatshirts-instead-weave-your-http://www.planetgeek.ch/2013/08/31/dont-wear-woven-sweatshirts-instead-weave-your- assemblies/assemblies/  http://haacked.com/archive/2013/01/04/mitigate-the-billion-dollar-mistake-with-aspects.aspx/http://haacked.com/archive/2013/01/04/mitigate-the-billion-dollar-mistake-with-aspects.aspx/ LinksLinks
  • 20.
  • 21. The end – wake up nowThe end – wake up now 