Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6221727
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:11:05+00:00 2026-05-24T08:11:05+00:00

I have an postsharp attribute for handling exceptions in a entire dll ( that

  • 0

I have an postsharp attribute for handling exceptions in a entire dll ( that ddl is provided by other team) and manage database calls.
So the idea is treat the exceptions with postsharp

So, this is the attribute

[Serializable]
    public class MethodConnectionTracking: OnExceptionAspect
    {
        bool canceled = false;
        public override void OnException(MethodExecutionArgs args)
        {
            Exception ex = args.Exception;
            if (ex != null)
            {
               --- do things
            }

        }


    }

to make that works and intercept all methods in the assemblyInfo.cs for that project called SPData i have:

[assembly: MethodConnectionTracking(AttributeTargetElements = MulticastTargets.Method)]

and that works great. But i want to specify that line in other project.

So, the main project references SPData. So, in main project AssemblyInfo.cs file i write:

[assembly: MethodConnectionTracking(AttributeTargetAssemblies = "SPData", AttributeTargetElements = MulticastTargets.Method)]

But it does not work.

Is it possibly to do what i want, Am I missing some parameter?

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T08:11:06+00:00Added an answer on May 24, 2026 at 8:11 am
    1. You don’t need AttributeTargetElements = MulticastTargets.Method as it is already provided when using OnExceptionAspect base class

    2. You don’t need to check if ex != null because it will never be null as OnException won’t be invoked unless there is an exception. See http://programmersunlimited.wordpress.com/2011/08/01/postsharp-why-are-my-arguments-null/

    Are you sure you have the correct assembly name? Are you using the namespace? You need to use the actual assembly name (without the .dll). Try a wildcard “SPData*” and see if that helps.

    Have you stepped through the code or looked at the compiled assembly using ILSpy? Unless you are providing the wrong name, it should work. Is the reference to a project or a compiled assembly? Is the assembly signed or obfuscated?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I'm working with PostSharp to pull out boilerplate logging/exception handling code so that
I have a simple PostSharp logging attribute: [Serializable] public class MethodLoggingAttribute : OnMethodBoundaryAspect {
I have heard of PostSharp, but I am wondering if there are any other
Have some dates in my local Oracle 11g database that are in this format:
I have some problem with PostSharp (I assume that problem can be solved by
I have a project Company.Business that I'm trying to target with PostSharp to wrap
I'd like to have property getters and methods that I can decorate with my
In the examples on their website, PostSharp has a demo of intercepting calls in
I have setup a Visual Studio project that I have edited to reference the
I have a project that currently compiles happily on my dev machine using VS

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.