|
|
Posted 10/25/2008 5:44:12 AM
|
|
|
Community Member
|
|
Hi,
Source:
public void Foo( [NotNull]String arg ) { Console.WriteLine( "Foo:" + arg ); }
Generated code by PostSharp (thanks to reflector <!-- s;-) --> <!-- s;-) -->)
private void ~Foo(string arg) { Console.WriteLine("Foo:" + arg); }
as you can notice the parameter attribute is missing from the generated code but is present on the new public method.
Is this an intended behavior? is it possible to have all the attributes reported also on the generated private method?
I'm using PostSharp 1.5 CTP1 (1.5.1.410)
TIA, best regards .m
|
|
|
|
Posted 10/25/2008 9:16:08 AM
|
|
|
Gael Fraiteur
SharpCrafters
|
|
The normal behavior is to move custom attributes to the public method, since most attributes are "semantic-bound" and not "implementation-bound".
If you want to mark a custom attribute type as implementation-bound, you should use the custom attribute ImplementationBoundAttribute.
And if it does not work according to this, you can report a bug <!-- s:) --> <!-- s:) -->.
-gael
|
|
|
|
Posted 10/26/2008 7:40:27 AM
|
|
|
Community Member
|
|
Hi Gael,
it works like a charme! I'm totally new to PostSharp, just a few hours testing <!-- s;-) --> <!-- s;-) -->
Great work, thank you.
.m
|
|
|
|
Posted 10/26/2008 7:52:42 AM
|
|
|
Community Member
|
|
Hi,
I was doing some testing and I realized why you decided to use the "ImplementationBuond" concept... now is there a way to have the attribute on both side? the public and the private implementation?
from: public void Foo( [NotNull]String arg ) { Console.WriteLine( "Foo:" + arg ); }
to: public void Foo( [NotNull]String arg ) { //PostSharp code... }
private void ~Foo( [NotNull]string arg ) { Console.WriteLine("Foo:" + arg); }
.m
|
|
|
|
Posted 10/26/2008 8:27:22 AM
|
|
|
Gael Fraiteur
SharpCrafters
|
|
|
|
|
Posted 10/26/2008 9:04:28 AM
|
|
|
Community Member
|
|
Hi,
I solved the "problem" using OnMethodBoundaryAspect that does not generate a new method but inject code in the existing one.
.m
|
|
|
|