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
Currently, StaticMethodMustNotBeVoid reports an error on the Main entry-point method of an application. Main has to be void.
Winform applications are decorated with [STAThread], but this doesn't apply to console applications. The method can be decorated with [HasSideEffects], but this somehow seems odd for an entry point method.
One solution would be to simply have the analyzer ignore methods called Main.
What might be better is to add support for a new [ApplicationStartup] attribute that can be used in this situation. It's tempting to limit this to methods named Main, but other folk may well use other method names, which would cause problems.
The text was updated successfully, but these errors were encountered:
Currently,
StaticMethodMustNotBeVoid
reports an error on theMain
entry-point method of an application.Main
has to be void.Winform applications are decorated with
[STAThread]
, but this doesn't apply to console applications. The method can be decorated with[HasSideEffects]
, but this somehow seems odd for an entry point method.One solution would be to simply have the analyzer ignore methods called
Main
.What might be better is to add support for a new
[ApplicationStartup]
attribute that can be used in this situation. It's tempting to limit this to methods namedMain
, but other folk may well use other method names, which would cause problems.The text was updated successfully, but these errors were encountered: