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 7605287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:07:51+00:00 2026-05-31T00:07:51+00:00

I got following situation private volatile bool _inProgress = false; public void DoSomethingStart() {

  • 0

I got following situation

private volatile bool _inProgress = false;

public void DoSomethingStart()
{
  if(_inProgress == false)
  {
      foo.BeginInvoke(null, null); // DoSomething
      _inProgress = true;
  }
}

[CatchAllExceptionsFromHere]
private void DoSomething()
{ }

The aspects works so far. All exceptions are handeled from CatchAllExceptionsFromHere. But i want to set “_inProgress = false” in the finally clause of the aspect – so if DoSomething has finished “_inProgress” should be set to false. Since Attributes cant take any object – is there a workaround?

Thanks michael

  • 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-31T00:07:52+00:00Added an answer on May 31, 2026 at 12:07 am

    Aspects can take values on the declaration to set property values or just like a constructor. What you want is an OnMethodBoundaryAspect and in the OnExit method (which fires even if an error has occured, so it’s just like a finally) you want to set the value of _inProgress.

    However, the aspect needs to be an instance aspect and you’ll need to either import the _inProgress member or just introduce it so that the aspect has access to it. It depends on if your class needs access to it. If it does the have the aspect import the member. Read up on how to do these things with these links

    • Aspect lifetime & scope part 1
    • Aspect lifetime & scope part 2
    • Introducing members part 1
    • Introducing members part 2
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the situation. I've got the following interfaces: public interface Parent { }
I've got the following situation, Private Sub MyButton_Click(sender as Object, args as EventArgs) Handles
I've got the following situation A rails application that makes use of rjs /
I've got the following situation: var totalRecords = (from entry in invalidAccEntryRepository select entry).Where(entry
I've got the following situation: A User object has a Set of Permission objects
We've got the following situation, running from a single domain: Page A uses window.open()
I've got the following situation: <h2>This text is <span>pretty awesome</span></h2> I'm trying to give
Imagine I have the following situation: Test1.java import java.lang.ref.WeakReference; public class Test1 { public
I've got the following regex that was working perfectly until a new situation arose
I've got a following situation: Got a method def f(lst: List[Any]) , which does

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.