Testing Issue
I've followed the basic instructions in the Documentation for testing Aspects (https://doc.metalama.net/conceptual/aspects/testing/aspect-testing) Starting off with something simple to hopefully make it easier.
However I'm getting an Asert.Equal() failure.
Could the fact that CodeRush can automatically add regions to code when it is saved be the cause of this?
7 Replies
It turned out to be a small almost imperceptible formatting issue, each line was out by 1 character position.
Ok
Ah different issue now which to be frank I don't understand.
I created a new test .In the Transformed code that appears in the Transformed section of the obj folder I see the following;
What is it trying to tell me?
I don't see that if I do a standard Show metalama diffs on the method itself.
Ok forgive my ignorance here.
I'm getting this error message;
Error LAMA0612 The most likely cause of the compilation failure is a bug in an aspect. To diagnose the issue, build the project with the option '-p:MetalamaDebugTransformedCode=True' and inspect the transformed files in 'obj/Debug/.../metalama'. VtlSoftware.LoggingConsoleApp D:\source\repos\VtlSoftware.LoggingWithStringHandler\VtlSoftware.LoggingConsoleApp\CSC 1
The message I understand, what I don't is how to actually build said project with the relevant option.
Do
dotnet build '-p:MetalamaDebugTransformedCode=True
from the command line for instance.Well I'm well and truly at a loss with this. I'm building out a series of tests to test various possibilities that my logging aspect might encounter.
If I create methods with params and return values to log the test passes, but if it's just a void method it fails. The issue I'm facing is that I would expect the reason being given for failure to be equally applicable to a method with params and yet its not. I suspect that this is my own fault but at the same time I can't account for the discrepancy.
If I create methods with params and return values to log the test passes, but if it's just a void method it fails. The issue I'm facing is that I would expect the reason being given for failure to be equally applicable to a method with params and yet its not. I suspect that this is my own fault but at the same time I can't account for the discrepancy.
You should do
dotnet build -p:MetalamaDebugTransformedCode=True
, then the error messages will point to transformed files. You see how these files were transformed by your aspect or by Metalama, and look for the cause of the error from there.
Ok I got it.
You need to add this method:
it's because you're sending a string literal and not an interpolated string.That makes perfect sense, Thanks.