Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PropertyInvariant exception is being caught in Core.Aspekt OnException handler #10

Open
quentinlautischer opened this issue Dec 10, 2018 · 0 comments
Assignees
Labels

Comments

@quentinlautischer
Copy link

   class QAspekt : Aspekt.Aspect
    {
        public override void OnException(MethodArguments args, Exception e)
        {
            Console.WriteLine($"Arguments: {args.Arguments.ElementAt(0).Value} Exception: {e.Message}");
        }
    }

    [PropertyInvariant(nameof(DontNullMe), Contract.Constraint.NotNull)]
    class ThrairPrinter
    {
        private string DontNullMe { get; set; } = "Q";

        [QAspekt]
        public void Print(String str)
        {
            DontNullMe = null;
            Console.WriteLine(str);
        }
    }

Console

Hello World
Arguments: Hello World Exception: System.Void AspektTester.ThrairPrinter::set_DontNullMe() post-condition property 'DontNullMe' failed invariant value != null.
@mvpete mvpete added this to the Minimum Viable Product milestone Mar 3, 2019
@mvpete mvpete self-assigned this Mar 3, 2019
@mvpete mvpete added the bug label Mar 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants