SlideShare une entreprise Scribd logo
1  sur  21
{{
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 

Contenu connexe

En vedette

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
 
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_cAshamedCent199
 
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 CompraBint
 
Simulacro de examen lengua y literatura
Simulacro de examen lengua y literaturaSimulacro de examen lengua y literatura
Simulacro de examen lengua y literaturaAnicu12
 
Dominio internet
Dominio internetDominio internet
Dominio internetGeovypg
 
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 empresaskristinamorales
 
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 lopezMauricio Castro
 
Robots in Human Environments
Robots in Human EnvironmentsRobots in Human Environments
Robots in Human EnvironmentsAndreas Heil
 
happytal recrute !! Stage concierge hopital
happytal recrute !! Stage concierge hopitalhappytal recrute !! Stage concierge hopital
happytal recrute !! Stage concierge hopitalRomain Revellat
 
Dudley CCG Think Kidneys Update
Dudley CCG Think Kidneys UpdateDudley CCG Think Kidneys Update
Dudley CCG Think Kidneys UpdateRenal Association
 
Why Semantic Knowledge Graphs matter
Why Semantic Knowledge Graphs matterWhy Semantic Knowledge Graphs matter
Why Semantic Knowledge Graphs matterAndreas Blumauer
 
2014 artwork contest results
2014 artwork contest results2014 artwork contest results
2014 artwork contest resultshappylily1116
 
TECNOLOGIA DE MICROONDAS
 TECNOLOGIA DE MICROONDAS  TECNOLOGIA DE MICROONDAS
TECNOLOGIA DE MICROONDAS Medwaves
 

En vedette (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
 

Similaire à 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 exploitsvirtualabs
 
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 ErckOrtus 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 RubyistWill 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 Kriensmfrancis
 
Web of Technologies Again
Web of Technologies AgainWeb of Technologies Again
Web of Technologies Againdynamis
 
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 Makmfrancis
 
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 cloudJan Jongboom
 
Javaone2008 Bof 5102 Groovybuilders
Javaone2008 Bof 5102 GroovybuildersJavaone2008 Bof 5102 Groovybuilders
Javaone2008 Bof 5102 GroovybuildersAndres Almiray
 
Bringing The Sexy Back To WebWorkers
Bringing The Sexy Back To WebWorkersBringing The Sexy Back To WebWorkers
Bringing The Sexy Back To WebWorkersCorey Clark, Ph.D.
 
XSS Without Browser
XSS Without BrowserXSS Without Browser
XSS Without Browserkosborn
 
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 bugGustavo 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
 
Reusando componentes Zope fuera de Zope
Reusando componentes Zope fuera de ZopeReusando componentes Zope fuera de Zope
Reusando componentes Zope fuera de Zopementtes
 

Similaire à 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
 

Dernier

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 

Dernier (20)

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 

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 