Mark assembly as supported in the browser
- Mark unsupported API in the browser
- Enforce future marking of unsupported in the browser API via editorconfig
Closes #1894
Wouldn't it make sense to create a helper class which encapsulates
#if NET8_0_OR_GREATER
if (OperatingSystem.IsBrowser())
{
throw new PlatformNotSupportedException();
}
#endif
and is used everywhere this code is now? Something like
internal static class PlatformHelper
{
public void ThrowNotSupportedIfBrowser()
{
#if NET8_0_OR_GREATER
if (OperatingSystem.IsBrowser())
{
throw new PlatformNotSupportedException();
}
#endif
}
}
Wouldn't it make sense to create a helper class
There is already a Csla.Runtime namespace/directory in the Csla project. It has an IRuntimeInfo service and implementation.
Perhaps that would be the place for any such helper code?
Wouldn't it make sense to create a helper class
There is already a
Csla.Runtimenamespace/directory in theCslaproject. It has anIRuntimeInfoservice and implementation.Perhaps that would be the place for any such helper code?
Even better.
Dataflow analysis work on method body. if we put this If inside helper method, then we have to annotate everything with SupportedPlatform/UnsupportedPlatform
For example
PlatformHelper.ThrowNotSupportedIfBrowser()
// Data flow does not know that all code below unreacheable on browser.
// This will produce warning that WebClient is not supported on the browser platform.
var client = new WebClient();
if (OperatingSystem.IsBrowser())
{
throw new PlatformNotSupportedException();
}
// Data flow analysis is happy and say hello to you. He knows that this code
// never reachable on browser.
var client = new WebClient();
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.