CA2000 code analysis warning that should not occur

I have a little problem with CA2000 warning. In my project, which is defined as a launch project, I get this warning, although it should not happen.

Background: I am using Visual Studio 2010 with projects in .NET 3.5. The launch project is a WPF application.

In the App class, it looks like this:

public partial class App : System.Windows.Application {

        /// <summary>
        /// Application Entry Point.
        /// </summary>
        [System.STAThreadAttribute()]
        [System.Diagnostics.DebuggerNonUserCodeAttribute()]
        public static void Main() {
            AutoTester.App app = new AutoTester.App();
            app.Run();
        }
    }

The warning reads:

Warning 1 CA2000: Microsoft.Reliability: in the "App.Main ()" method, call System.IDisposable. Use the application object before all links to it go out of scope. C: \ Projects \ Freelance \ svn \ AutoTester \ Application \ Applications \ AutoTester \ obj \ x86 \ Debug \ App.g.cs 47 AutoTester

, App.g.cs, . . Msgstr " ". , ?

, , . , , CA2000.

- - , ?

, Christian

+3
1

" " , . Visual Studio , , GeneratedCodeAttribute (. ). -, , , .

:

[GeneratedCode("CodeGenerator", "1.0.0.0")]
public partial class App 
{
}
+2

Source: https://habr.com/ru/post/1792167/


All Articles