-
Notifications
You must be signed in to change notification settings - Fork 65
Consider surfacing additional diagnostics information as part of LocalizedString when a resource is not found. #258
Comments
Is there any reason that resource is not found except the resource file doesn't exist or the resource entry is not found? |
Probably one of the two. But it's still a guessing game where the instance of |
We may log where the APIs is looking for resources, this very helpful, it would be nice if we can see something like what MVC did when it doesn't find the view |
@hishamco just because you asked for, we're not able to figure out what should be the correct naming/location of a resource file mapping a nested class within a static wrapper class. Say we have a file at path namespace ProjectRoot.Feature
{
public static class Outer
{
// ...
public class Inner
{
public Inner(IStringLocalizer<Inner> localizer)
{
// ...
}
}
}
} We tried the following resource files, all withouth luck.
What's the correct way to accomplish this? |
Ok. Apparently we've been bitten by #296 . Nonetheless, I was not able to find any specific info on nested classes related to resource location & naming. It might be worth considering adding something about it to the docs. EDIT BTW, correct solution was the last: |
It appears that nothing in Localization is using DiagnosticSource, so writing out debug logging might be a large and potentially unwanted change, but we could very easily add a "LocationSearched" property to LocationString which users could examine. |
Even the localization doesn't using |
@pranavkm what do you think? Is it sufficient to add a property to LocalizationString or do we need to plumb logging stuff through? |
We've had instances in other areas of the stack where we've tried to use logging to present diagnostic information to the user. It's nice because you don't have to be live debugging the application to see the failure (as long as the log message was captured, you could inspect it). The issue with using logging to present details like this has been that it's not entirely obvious that the log is the place to look for when something goes wrong. Plumbing ILogger thru the |
I'm still wonder why we need to add a new property to |
Uh oh!
There was an error while loading. Please reload this page.
It might make it easier to diagnose why a specific resource string isn't located. Perhaps as part of the debugger display?
The text was updated successfully, but these errors were encountered: