Static weaving assembly without referencing Aspects

Dec 3, 2012 at 11:35 AM

I want to weave classes in an assembly but I don’t want to add reference from the target assembly to the Aspects assemblies (these aspects are only for testing), can I do it with Gripper?

In the example doing it in runtime with Loom.Weaver.Create<Base>... works in this manner since in Base assembly there is no reference to the Aspect or the Loom Library for that matter, can it be done with static weaveing Gripper?

Thanks,

 Doron

Coordinator
Dec 3, 2012 at 12:06 PM
Hi Doron,
yes you can do that. Gripper-LOOM also supports weaving by
configuration. If you have a look inte the example
03-SimpleTracingInstead, then you'll find a config.xml which gives you
an idea how it works.

Best regrads,

Wolfgang.



Am 03.12.2012 12:35, schrieb doronlevi:
> From: doronlevi
>
> I want to weave classes in an assembly but I don’t want to add
> reference from the target assembly to the Aspects assemblies (these
> aspects are only for testing), can I do it with Gripper? In the
> example doing it in runtime with Loom.Weaver.Create<Base>... works in
> this manner since in Base assembly there is no reference to the
> Aspect
> or the Loom Library for that matter, can it be done with static
> weaveing Gripper? Thanks, Doron
>
>
Dec 3, 2012 at 2:19 PM
Edited Dec 3, 2012 at 4:40 PM

 
Hi Wolfgang,
  Thanks a lot!
  Where cam I find the 03-SimpleTracingInstead? I installed the msi.

Thanks,
  Doron

Hi Doron,
yes you can do that. Gripper-LOOM also supports weaving by
configuration. If you have a look inte the example
03-SimpleTracingInstead, then you'll find a config.xml which gives you
an idea how it works.

Best regrads,

Wolfgang.



Am 03.12.2012 12:35, schrieb doronlevi:
> From: doronlevi
>
> I want to weave classes in an assembly but I don’t want to add
> reference from the target assembly to the Aspects assemblies (these
> aspects are only for testing), can I do it with Gripper? In the
> example doing it in runtime with Loom.Weaver.Create<Base>... works in
> this manner since in Base assembly there is no reference to the
> Aspect
> or the Loom Library for that matter, can it be done with static
> weaveing Gripper? Thanks, Doron
>
>
Coordinator
Dec 3, 2012 at 8:41 PM

Hi Doron,

usually it’s located in your user profile in \Documents\The Loom.Net Project\Gripper-Loom.Net. But you can also get this from the codeplex webpage:

http://loom.codeplex.com/SourceControl/changeset/view/18611#302638

Best regards,

Wolfgang.

Von: doronlevi [email removed]
Gesendet: Montag, 3. Dezember 2012 15:19
An: wolfgang@schult.biz
Betreff: Re: Static weaving assembly without referencing Aspects [loom:405359]

From: doronlevi

Hi Wolfgang,

Thanks a lot!

Where cam I find the 03-SimpleTracingInstead? I installed the msi.

Thanks,

Doron

wschult wrote:
Hi Doron,
yes you can do that. Gripper-LOOM also supports weaving by
configuration. If you have a look inte the example
03-SimpleTracingInstead, then you'll find a config.xml which gives you
an idea how it works.

Best regrads,

Wolfgang.



Am 03.12.2012 12:35, schrieb doronlevi:
> From: doronlevi
>
> I want to weave classes in an assembly but I don’t want to add
> reference from the target assembly to the Aspects assemblies (these
> aspects are only for testing), can I do it with Gripper? In the
> example doing it in runtime with Loom.Weaver.Create<Base>... works in
> this manner since in Base assembly there is no reference to the
> Aspect
> or the Loom Library for that matter, can it be done with static
> weaveing Gripper? Thanks, Doron
>
>

Dec 5, 2012 at 7:39 AM

 

Hi Wolfgang,

  I found the example and was able to progress, now I encounter a problem: 

  In my use case I have the following (gave meaningful names so it will be helpful): 


  1. Assembly L that has the logic that is the target of the Aspect.  
  2. Assembly A that has the Aspect, this assembly references other assemblies that the Aspect logic requires.
  3. Assembly E that is the executing assembly (the exe file), AssemblyE references AssemblyL.

 

I use the following xml: 

<?xml version="1.0" encoding="utf-8" ?>

<loom>

  <assembly name="AssemblyL">

    <type name="AssemblyL.MyLogicClass">

                  <apply-aspect type="AssemblyA.MyAspect, AssemblyA"/>    

    </type>

  </assembly>

</loom>

 

I run command:

 

gl "C:\Users\levid\Documents\Visual Studio 2010\Projects\AssemblyE\bin\Debug\AssemblyE.exe" -Aspects:" C:\Users\levid\Documents\Visual Studio 2010\Projects\AssemblyE\config.xml"

 

I get following output: 

Gripper-Loom.NET aspect weaving post-compiler

(C) 2001-2012 by Wolfgang Schult. All rights reserverd.

 

Processing assembly:

AssemblyE

.

.

AssemblyL 

Generate glue code for type:

Could not load file or assembly 'AssemblyE, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. 

Build failed. 

Am I doing anything wrong? can I do anything to trouble shoot this?

(BTW, my aspect drives from Loom.Aspect) 

Thanks,

  Doron

 

Coordinator
Dec 5, 2012 at 10:20 PM

Hi Doron,

try to specify the complete path of AssemblyA with the “–LibPath:<…>” option. Is AssemblyE signed?

Best regards,

Wolfgang.

Von: doronlevi [email removed]
Gesendet: Mittwoch, 5. Dezember 2012 08:40
An: wolfgang@schult.biz
Betreff: Re: Static weaving assembly without referencing Aspects [loom:405359]

From: doronlevi

Hi Wolfgang,

I found the example and was able to progress, now I encounter a problem:

In my use case I have the following (gave meaningful names so it will be helpful):

1. Assembly L that has the logic that is the target of the Aspect.

2. Assembly A that has the Aspect, this assembly references other assemblies that the Aspect logic requires.

3. Assembly E that is the executing assembly (the exe file), AssemblyE references AssemblyL.

I use the following xml:

<?xml version="1.0" encoding="utf-8" ?>

<loom>

<assembly name="AssemblyL">

<type name="AssemblyL.MyLogicClass">

<apply-aspect type="AssemblyA.MyAspect, AssemblyA"/>

</type>

</assembly>

</loom>

I run command:

gl "C:\Users\levid\Documents\Visual Studio 2010\Projects\AssemblyE\bin\Debug\AssemblyE.exe" -Aspects:" C:\Users\levid\Documents\Visual Studio 2010\Projects\AssemblyE\config.xml"

I get following output:

Gripper-Loom.NET aspect weaving post-compiler

(C) 2001-2012 by Wolfgang Schult. All rights reserverd.

Processing assembly:

AssemblyE

.

.

AssemblyL

Generate glue code for type:

Could not load file or assembly 'AssemblyE, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

Build failed.

Am I doing anything wrong? can I do anything to trouble shoot this?

(BTW, my aspect drives from Loom.Aspect)

Thanks,

Doron

Dec 6, 2012 at 8:48 AM

Hi Wolfgang,

  I can now narrow my use case:

AssemblyA references other assemblies: AssemblyC1

AssemblyE (the exe) also references AssemblyC1 

When I target AssemblyE for weaving I get the above failure but if I add a mediator assembly, AssemblyM (a dll), that calls AssemblyL and I  target AssemblyM for weaving it works!

The failing case:

AssemblyE ->  AssemblyL                                                  

     ->  AssemblyC1

 

AssemblyA ->  AssemblyC1 

The work around:

               

AssemblyM ->  AssemblyL 


AssemblyE ->  AssemblyM                                                                 

               ->  AssemblyC1


AssemblyA ->  AssemblyC1

  

In other words when the target weaving assembly shares the same dependency as the aspect assembly I get a failure:

 

This is the console output of the failure targeting AssemblyE (note that there was attempt to process AssemblyC1)

 

Gripper-Loom.NET aspect weaving post-compiler

(C) 2001-2012 by Wolfgang Schult. All rights reserverd.

 

Processing assembly:

AssemblyE

AssemblyC1

AssemblyL

 

Generate glue code for type:

Could not load file or assembly AssemblyE, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or

 one of its dependencies. The system cannot find the file specified.

Build failed.

 

This is the console output of the success using a mediator,  targeting AssemblyM (no processing of AssemblyC1) 

 

Gripper-Loom.NET aspect weaving post-compiler

(C) 2001-2012 by Wolfgang Schult. All rights reserverd.

 

Processing assembly:

AssemblyM

AssemblyL

 

Generate glue code for type:

AssemblyL.MyLogicClass

 

Rewriting assembly:

AssemblyM.dll

AssemblyL.dll

 

Can this issue be worked out? 

Thanks,

  Doron

 

Coordinator
Dec 7, 2012 at 11:12 PM
Hi Doron,
Could you please send me an example of this issue?

Best regards,


Wolfgang.

Am 06.12.2012 um 09:48 schrieb "doronlevi" <notifications@codeplex.com>:

From: doronlevi

Hi Wolfgang,

I can now narrow my use case:

AssemblyA references other assemblies: AssemblyC1

AssemblyE (the exe) also references AssemblyC1

When I target AssemblyE for weaving I get the above failure but if I add a mediator assembly, AssemblyM (a dll), that calls AssemblyL and I target AssemblyM for weaving it works!

The failing case:

AssemblyE -> AssemblyL

-> AssemblyC1

AssemblyA -> AssemblyC1

The work around:

AssemblyM -> AssemblyL


AssemblyE -> AssemblyM

-> AssemblyC1


AssemblyA -> AssemblyC1

In other words when the target weaving assembly shares the same dependency as the aspect assembly I get a failure:

This is the console output of the failure targeting AssemblyE (note that there was attempt to process AssemblyC1)

Gripper-Loom.NET aspect weaving post-compiler

(C) 2001-2012 by Wolfgang Schult. All rights reserverd.

Processing assembly:

AssemblyE

AssemblyC1

AssemblyL

Generate glue code for type:

Could not load file or assembly AssemblyE, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or

one of its dependencies. The system cannot find the file specified.

Build failed.

This is the console output of the success using a mediator, targeting AssemblyM (no processing of AssemblyC1)

Gripper-Loom.NET aspect weaving post-compiler

(C) 2001-2012 by Wolfgang Schult. All rights reserverd.

Processing assembly:

AssemblyM

AssemblyL

Generate glue code for type:

AssemblyL.MyLogicClass

Rewriting assembly:

AssemblyM.dll

AssemblyL.dll

Can this issue be worked out?

Thanks,

Doron