My .NET Core library needs to read some info from registry if it's available or leave the default value if it's not. I would like to get the idea of best practices of doing that.
I think I could wrap the registry initialization/usage block in try/catch or I can check if the current platform is Windows but I don't think these are best practices (it's better to avoid exceptions and there is no guarantee that ANY Windows-based platform will have the registry, etc).
For now, I will rely on
bool hasRegistry = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
but wondering if there is a more reliable/universal solution.