Skip to content

Local variables in sync methods are not visible in the VS debugger  #217

@DaemonSharps

Description

@DaemonSharps

Environment:

  • OS: windows
  • Framework: net6.0
  • Type of application: Nunit Test Application
  • Version of AspectInjector: 2.8.1

Describe the bug
Local variables are not visible when debugging synchronous methods when using AspectInjector.

To Reproduce
I am using example from README

[Aspect(Scope.Global)]
[Injection(typeof(AroundTests_Simple))]
public class AroundTests_Simple : Attribute
{
        [Advice(Kind.Around, Targets = Target.Method)]
        public object AroundMethod([Argument(Source.Target)] Func<object[], object> target,
            [Argument(Source.Arguments)] object[] arguments)
        {
            return target(arguments);
        }
    }

Use with synchronous test method.

[TestFixture]
    public class TestClass
    {
        [Test]
        [AroundTests_Simple]
        public void Test()
        {
            var test = 1;

            Assert.True(test == 1);
        }
}

And get that exception:
image

But with async method it works correctly:
image

Additional info:
Old issue for async methods
#71

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions