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!
5 Replies
Gael Fraiteur
Gael Fraiteur2y 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.
Whit
WhitOP2y ago
Will do - stepped out for the weekend, but I'll give it a shot Monday when I get back home.
Gael Fraiteur
Gael Fraiteur2y ago
Have a good time.
Whit
WhitOP2y 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 Fraiteur2y 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