I have the following scenario:
Where ProjectA
is a simple class library, and ProjectB
is a Console Application.
ProjectA.Class1.cs
contains the following code:
using System;
namespace ProjectA
{
public class Class1
{
public void A()
{
B();
}
[Weaver]
public void B()
{
Console.WriteLine("I'm in B()");
}
}
}
ProjectA.Weaver.cs
contains:
using MethodDecorator.Fody.Interfaces;
using System;
using System.Reflection;
namespace ProjectA
{
class Weaver : Attribute, IMethodDecorator
{
public void Init(object instance, MethodBase method, object[] args)
{
Console.WriteLine("Initialising");
}
public void OnEntry()
{
Console.WriteLine("Entry");
}
public void OnException(Exception exception)
{
Console.WriteLine("Exception");
}
public void OnExit()
{
Console.WriteLine("Exit");
}
}
}
And the Console Application's (ProjectB.Program.cs
)entry point contains:
using ProjectA;
namespace ProjectB
{
class Program
{
static void Main(string[] args)
{
var a = new Class1();
a.A();
}
}
}
And ProjectA.FodyWeavers.xml
contains:
<?xml version="1.0" encoding="utf-8"?>
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<MethodDecorator></MethodDecorator>
</Weavers>
If I put a breakpoing inside Class1.A()
, and attempt to Step-into (F11
), the following Source Not Available window pops up:
Is there a way to:
- Prevent the debugger from attempting to step into the weaver
- Tell the debugger where the source code for the weaver is
I've tried:
- Enabling Just My Code
- Adding Attributes to the
Weaver.cs
methods ([DebbugerNonUserCode]
,[DebbugerStepThrough]
,[DebbugerHidden]
...) - Adding the Fody references to the
ProjectB
- Setting the project's Build Debugging Information to
Full
Using:
- Visual Studio 2019 Community Edition
- .NET Framework 4.7.2
- Fody 6.2.0
- MethodDecorator.Fody 1.1.0