Runtime weaving
5 posts • Page 1 of 1
Runtime weaving
Hi everbody!
I wanna use postsharp but during application execution. Im trying to weave a type onthefly. How can i use postsharp in this way?
Thanks in advance.
Ignacio.
I wanna use postsharp but during application execution. Im trying to weave a type onthefly. How can i use postsharp in this way?
Thanks in advance.
Ignacio.
Ignacio Vivona
- cocotapioca
- Posts: 19
- Joined: Sat Jan 12, 2008 4:55 pm
- Full Name: Ignacio Vivona
Re: Runtime weaving
The feature is not ready for off-the-shelf use. If you develop a big and expensive software like an application server, you can use the low-level APIes to host PostSharp. But there is no runtime host currently available for end-users.
Gael
Gael
Gael Fraiteur, project leader
got good support? consider donating to the project.
got good support? consider donating to the project.
- gfraiteur
- Site Admin
- Posts: 674
- Joined: Tue Dec 18, 2007 3:09 pm
- Full Name: Gael Fraiteur
- Company: postsharp.org
Re: Runtime weaving
Good evening
I wanted to ask how is your progress with the runtime weaving toolkits? I'm looking for a possibility to weave types at runtime with certain aspects. How can this be achieved with Postsharp without the big overhead and difficulties of the Host?
Thanks for your response
Daniel
I wanted to ask how is your progress with the runtime weaving toolkits? I'm looking for a possibility to weave types at runtime with certain aspects. How can this be achieved with Postsharp without the big overhead and difficulties of the Host?
Thanks for your response
Daniel
- LOBOMINATOR
- Posts: 2
- Joined: Sun Jul 13, 2008 7:26 pm
- Full Name: Marbach DANIEL
Re: Runtime weaving
I've invested must time in investigating runtime weaving. Unfortunately, it won't get better. Here are my conclusions:
Hi Mark,
As promised in March, I’ve been experimenting with the CLR hosting API (the most similar thing to Java class loader in .NET) in order to achieve runtime weaving.
The result is unfortunately mostly negative:
• If we opt for the possibility to intercept assembly loading (before loading), we lose the support for LoadFrom/LoadFile/LoadBytes. Too bad since many .NET features (notably XML serialization) rely on that.
• Supposing we would overcome the problem above, we could weave only the applications we actually bootstrap. This excludes ASP.NET, COM objects and the like.
So at the end of the day, the situation is identical as in November 2006: we can do runtime weaving if you modify the assembly before they are being resolved, which means that:
• We should bootstrap the application to be aspected (as an application server like JBoss does),
• We should weave all references and dependencies ahead-of-time.
• We have to remove strong keys during transformation, which means that loose references to the assembly (giving the assembly name in a string, for instance in a configuration file) would fail.
So finally, runtime weaving is possible if the application has been specifically designed for it, but it is not possible, and won’t be in foreseeable time, to make a weaver that would transform arbitrary, non-aware applications.
The old sample PostSharp.Samples.Host (dating from Nov 2006) is thus still valid. It is a minimalistic weaving bootstrapper (applying the identity transformation).
Cheers!
Gael
Gael Fraiteur, project leader
got good support? consider donating to the project.
got good support? consider donating to the project.
- gfraiteur
- Site Admin
- Posts: 674
- Joined: Tue Dec 18, 2007 3:09 pm
- Full Name: Gael Fraiteur
- Company: postsharp.org
Re: Runtime weaving
Thanks gael for your kind answer!
Have a nice day
Daniel
Have a nice day
Daniel
- LOBOMINATOR
- Posts: 2
- Joined: Sun Jul 13, 2008 7:26 pm
- Full Name: Marbach DANIEL
5 posts • Page 1 of 1