Step-through aspect-debugging

I'm sure I've asked this before, but I cannot find the thread in which it was answered (if I actually did).
Given an aspect, is it possible to step through my code (e.g. see the while Metalama is building the compile-time code? I'm trying to determine if a given type implements an IEnumerable, and if so, what the generic argument is for this IEnumerable, but I can't figure out how to peek inside it while debugging (Debugger.Break never hits) to see what precisely is happening.
if (typeof(IEnumerable).IsAssignableFrom(prop.Type.ToType()))
{
var genericTypes = prop.Type.ToType().GetInterfaces().FirstOrDefault(t =>
t.IsGenericType && t.GetGenericTypeDefinition() == typeof(IEnumerable<>));
if (genericTypes == null)
continue;

var innerGenericType = genericTypes.GetGenericArguments()[0];
if (typeof(IEnumerable).IsAssignableFrom(prop.Type.ToType()))
{
var genericTypes = prop.Type.ToType().GetInterfaces().FirstOrDefault(t =>
t.IsGenericType && t.GetGenericTypeDefinition() == typeof(IEnumerable<>));
if (genericTypes == null)
continue;

var innerGenericType = genericTypes.GetGenericArguments()[0];
I tried following the instructions at https://doc.metalama.net/conceptual/aspects/testing/debugging-aspects#debugging-compile-time-logic I inserted Debugger.Break() before my If statement, popped open a console window pointing at the project directory and ran dotnet build -p:MetalamaDebugCompiler=True. It asked me to pick a debugger, so I selected VS 2022 and it opened, loaded some symbols and then indicated that the task had been cancelled and that was it. What am I missing about that process? Thanks!
Gael Fraiteur
Gael Fraiteur295d ago
There were some bugs in this debugging experience but they were fixed in 2023.3. Please try with this version and let me know how it went.
Xaniff
Xaniff295d ago
Will do - stepped out for the weekend, but I'll give it a shot Monday when I get back home.
Gael Fraiteur
Gael Fraiteur295d ago
Have a good time.
Xaniff
Xaniff293d ago
Could you consider doing an upcoming video showing how the debug experience works? I keep getting the breakpoint hit, but I cannot get it to actually show my source or really anything except the disassembly which renders the debugging experience not too useful.
Gael Fraiteur
Gael Fraiteur292d ago
What about this one? https://doc.metalama.net/videos/debugging And for the source mapping issue I think this was solved in 2023.3.
Want results from more Discord servers?
Add your server
More Posts
CodeLens HelpMetalama is configured in CodeLens, and I have an aspect that has been applied. I am able to right-How to apply an attribute to a method introduced by another aspect?I have an aspect that has a dependency on another aspect. However, I'd like for downstream projects Advising the addition of code commentsUsing Metalama Is there a way to advise adding code comments? For example, when I advise a method Set eligibility to not run against (built-in) methods of record classes or structsI've figured out how to set up an `If` statement for the record types, but I cannot figure out how tHow to specify an IMethod as the callback for an event?I'd like to specify an introduced method on a TypeAspect as the callback for an event handler. 1) WCreate NuGet with MetalamaWith source generators I have to add some MSBuild configuration, but with Metalama it seems I don't Override property with BuildAspectI create exceptions inheriting from Exception and putting the `[BusinessException]` attribute. I waView diff in RiderI don't use Visual Studio, and overall, I don't have Windows. Is there any way to see the source genOverride constructorIs it possible to override a constructor? I want to take my code: ``` public class BusinessExceptiDoes Metalama only support attributes?I navigated in all Metalama documentation, but I want to override a method for all types that inheriCan Metalama suppress compiler errors?Hello! I want to know if I can use Metalama in my library. The users of my library have to declare Eligibility rule based on target method not returning voidTypically eligibility rules I've put together are based on a specifically typed return or paramters.Follow up question from yesterday's meetupNow that I've had time to review what was discussed I think I can now ask the question I'd wanted toPlease cache licensing key rather than check every buildEvery time I attempt to build an aspect today, I'm getting an error that I've got an invalid license