-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix debug information by just using the debug scopes from original me…
…thod
- Loading branch information
Showing
3 changed files
with
59 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
src/MethodBoundaryAspect.Fody.UnitTests.TestProgram.NetFramework/WrongDebugVariableNames.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using MethodBoundaryAspect.Fody.Attributes; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace MethodBoundaryAspect.Fody.UnitTests.TestProgram.NetFramework | ||
{ | ||
internal class WrongDebugVariableNames | ||
{ | ||
public void Call() | ||
{ | ||
DoSomeStuff2(new List<int>{42}); | ||
} | ||
|
||
[MethodInterceptor] | ||
private void DoSomeStuff2(List<int> youcanseethis) | ||
{ | ||
var andThis = youcanseethis.Take(1); | ||
var rand = new Random(); | ||
if (rand.NextDouble() > 0.5) | ||
{ | ||
var butNotThis = youcanseethis.Take(1); | ||
Console.WriteLine("Larger than 0.5"); | ||
Console.WriteLine($"{butNotThis}"); | ||
} | ||
else | ||
{ | ||
var butNotThis = youcanseethis.Take(1); | ||
Console.WriteLine("Smaller than 0.5"); | ||
Console.WriteLine($"{butNotThis}"); | ||
} | ||
} | ||
} | ||
|
||
public sealed class MethodInterceptor : OnMethodBoundaryAspect | ||
{ | ||
public override void OnEntry(MethodExecutionArgs args) | ||
{ | ||
Console.WriteLine("Enter: " + args.Instance.GetType().FullName + "." + args.Method.Name); | ||
} | ||
|
||
public override void OnExit(MethodExecutionArgs args) | ||
{ | ||
Console.WriteLine("Exit: "+ args.Instance.GetType().FullName +"."+args.Method.Name); | ||
} | ||
|
||
public override void OnException(MethodExecutionArgs args) | ||
{ | ||
Console.WriteLine(args.Exception); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters