Le réseau pour les développeurs > Forums - Accueil > Off-Topic Posts (Do Not Post Here) > False Positive "CA2000: Dispose objects before losing scope" Code Anaylsis warning
Poser une questionPoser une question
 

QuestionFalse Positive "CA2000: Dispose objects before losing scope" Code Anaylsis warning

  • vendredi 6 novembre 2009 15:17Chris_Pearce Médailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateurMédailles de l'utilisateur
     

    In Visual Studio 2010 Beta 2, Code Analysis is raising the following warning:

          CA2000:Dispose objects before losing scope

    for the code:

        PlaceHolder placeHolder1 = this.FindControl("placeHolder1");

      // create a control to open the literal
      Literal literal1 = new Literal
      {
         Text =
    "My Literal",
         ID =
    "literal1"
      };
      placeHolder1.Controls.Add(literal1);


    I believe this is incorrect. Apologies if it is expected behaviour.

    Cheers



    Chris

    • DéplacéHarry ZhuMSFTvendredi 13 novembre 2009 02:01 (From:Visual C# Language)
    •  

Toutes les réponses