SharpCrafters Forum – Issue with VisualStudio 3.5 and assembly entries

SharpCrafters Support Forum

        


Issue with VisualStudio 3.5 and assembly... Expand / Collapse
Author
Message
Posted 3/9/2009 4:27:05 PM


Community Member
I  am running C# 3.5 (on XP Pro) and am having issues with entries at the assembly level. I have rolled the build back to 2.0 and 3.0 as well, and no luck.

In the first example, Logging , one of the two entries work.
This one works:
[assembly: Trace("Logging")]
...with TraceAttribute class ignored: [Trace(null, AttributeExclude = true)]

and this one doesn't:
[assembly: Trace("Logging", AttributeTargetTypes = "say*")]

In the second example, PerformanceCounter, the entry is:
[assembly: PerformanceCounter(AttributeTargetAssemblies = "mscorlib", AttributeTargetTypes = "System.IO.*")]


The results in both cases that fail are that the code compiles, but the overrides never happen. So it seems that AttributeTargetTypes may be incompatible with 3.5.
On the logging example, I tried replacing say* with sayHello (and verified the case is correct) but still no luck.

Has anyone else run into this, or do you have any ideas?

Thanks!
Damon
Post #2995
Posted 3/12/2009 12:50:47 PM


Gael Fraiteur

SharpCrafters
I am not sure I understand your problem. Anyway, PostSharp is not related to the version of .NET (a fortiori C#) you are running, if 2.0 or 3.5.

Remember that the property AttributeTargetTypes  evaluates the full type name (including namespace, excluding member name).

-g
Post #2996
Posted 3/20/2009 7:45:46 PM


Community Member
Your comment
"Remember that the property AttributeTargetTypes evaluates the full type name (including namespace, excluding member name)."
helped.

So now this is halfway resolved. I'm following your tracing/logging example over at codeproject http://www.codeproject.com/KB/cs/ps-custom-attributes-1.aspx

I was having problems with the performance monitoring (also from the assembly level) and tracing from the assembly level, filtering by the method.


On the performance monitoring, I still need a tip or pointer These statements do not work:

[assembly: PerformanceCounter(AttributeTargetAssemblies = "mscorlib", AttributeTargetTypes = "System.IO.*")]//  - FAILS
[assembly: PerformanceCounter(AttributeTargetAssemblies = "*", AttributeTargetTypes = "System.IO.*")]// - FAILS
[assembly: PerformanceCounter(AttributeTargetTypes = "System.IO.*")]// - FAILS


These statements work, but only traces the HavingFunWith...

[assembly: PerformanceCounter(AttributeTargetTypes = "*")]//WORKS
[assembly: PerformanceCounter(AttributeTargetTypes = "HaveFun*.PerformanceCounter.*")]//WORKS
// output is HaveFun...PerformanceCounter.Program/Void ListFolder(System.String, Int32): 22 hits, 849.89 ms total, 38.63 ms average



On the tracing, your comment helped me solve it. When you said AttributeTargetTypes excludes the member name, I went back and looked at the example (which was passing the method names "Say*". Anyway I got hit with the copy/paste (or impatiently reading too fast) bug, because I needed AttributeTargetMembers="say*" instead; that solved that part of it.
Post #2997
Posted 3/23/2009 10:08:46 AM


Gael Fraiteur

SharpCrafters
There may be a bug somewhere, because that stuff is supposed to work. Could you report it to <!-- m --><a class="postlink" href="http://www.postsharp.org/tracker">http://www.postsharp.org/tracker</a><!-- m -->?

Thanks.

-gael
Post #2998
Posted 4/9/2009 8:42:25 PM


Community Member
Sorry for the delay, I just returned from vacation.

Reported at:
<!-- m --><a class="postlink" href="http://www.postsharp.org/tracker/view.php?id=325">http://www.postsharp.org/tracker/view.php?id=325</a><!-- m -->
Post #2999
« Prev Topic | Next Topic »


All times are GMT +1:00, Time now is 2:03am

Powered By InstantForum.NET v4.1.4 © 2010
Execution: 0.186. 7 queries. Compression Disabled.