Request: Loosen restrictions limiting the use of AddExpression on InterpolatedStringBuilder only within a template
WhitWaldo opened this issue · 1 comments
Today, I get the following error:
LAMA0233 Cannot use 'InterpolatedStringBuilder.AddExpression(dynamic?, int?, string?)' in 'LogAttribute.BuildParameterValueMessage(bool)' because it is only allowed inside a template.
I use this within a static method so that I might put all the code necessary to build this string in a single method instead of repeating it once for a synchronous method and once for an asynchronous method. The output of this is used exclusively within either of the synchronous and asynchronous template methods, as well as to build out the string values for log entries in the try/catch/finally blocks.
I'd like to request that this restriction be loosened so I can create these helper methods and avoid the code duplication within my attributes (as I've instead had to copy/paste the same thing 6 times now).
The example here suggests that this shouldn't be an error I'm experiencing as it uses precisely that private static method to build the logging values, but applying similar code to my own project now shows that error on meta.CompileTime
with:
LAMA0233: Cannot use 'meta.CompileTime(int)` in ... because it is only allowed inside a template.
Here's a snippet of the code in VS with the red squiggly showing what I'm seeing:
Thank you!
Found the preview docs and noticed that meta.CompileTime
is no longer used.