c# - UseObjectDisposedExceptionRule : A method of an IDisposable type does not throw System.ObjectDisposedException -


i have page in mvp model. properties in view interface implemented in code behind ie .aspx.cs file. in of properties implemented in code behind , code monitoring tool shows warning like:

useobjectdisposedexceptionrule : method of idisposable type not throw system.objectdisposedexception.

the exception shown in setter ie,

    public bool isoktoptoceed     {         {      return _isoktoproceed;     }     set     {     /// warning displayed in line     _isoktoproceed=value;     }     } 

how supposed handle warning? using try catch block while setting value?

it guideline prevent use-after-dispose.

set {    /// warning displayed in line    if (this.isdisposed)        throw new objectdisposedexception("<classname>");     _isoktoproceed=value; } 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -