You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
C# has a feature, which is particularly useful in logging frameworks, but which renders the JustAssembly comparison functionality almost useless.
The C# feature works like this:
You define a method on your logger API:
public void LogMessage(string message, [CallerFilePath] string filePath = "")
{
}
And you call it just like this:
myLogger.LogMessage("thisisthemessage");
The C# compiler then automatically determines the file path your call is in, and hard-codes that in the IL code. Similarly for [CallerMemberName] and [CallerLineNumber].
If you use e.g. VS Team Services build, it will create a temporary folder and build your code in that. So two consecutive builds will have different paths.
When you then compare two assemblies with JustAssembly, it will show that
myLogger.LogMessage("thisisthemessage", @"c:\temp\randomfolder1\application\file.cs");
is different from
myLogger.LogMessage("thisisthemessage", @"c:\temp\randomfolder2\application\file.cs");
And it does this all over the place, because you emit logs all over the place.
It would be nice if JustAssembly would suppress such differences when it can see that the difference in the .dll is not due to a difference in the .cs, but rather due to the callee using the [CallerFilePath] feature.
The text was updated successfully, but these errors were encountered:
C# has a feature, which is particularly useful in logging frameworks, but which renders the JustAssembly comparison functionality almost useless.
The C# feature works like this:
You define a method on your logger API:
public void LogMessage(string message, [CallerFilePath] string filePath = "")
{
}
And you call it just like this:
myLogger.LogMessage("thisisthemessage");
The C# compiler then automatically determines the file path your call is in, and hard-codes that in the IL code. Similarly for [CallerMemberName] and [CallerLineNumber].
If you use e.g. VS Team Services build, it will create a temporary folder and build your code in that. So two consecutive builds will have different paths.
When you then compare two assemblies with JustAssembly, it will show that
myLogger.LogMessage("thisisthemessage", @"c:\temp\randomfolder1\application\file.cs");
is different from
myLogger.LogMessage("thisisthemessage", @"c:\temp\randomfolder2\application\file.cs");
And it does this all over the place, because you emit logs all over the place.
It would be nice if JustAssembly would suppress such differences when it can see that the difference in the .dll is not due to a difference in the .cs, but rather due to the callee using the [CallerFilePath] feature.
The text was updated successfully, but these errors were encountered: