0

Am not sure if am repeating this question. For Code violation for throwing System.ObjectDisposedException. Statndard solution is to have below function call for each function

private void CheckDisposed()
{
    throw new ObjectDisposedException(GetType().FullName);
}

more here https://stackoverflow.com/a/1964521/1481690

Instead of calling this method in each function.How can i make this happen for all functions globally like in single place across application. Am using Mvc5.

Community
  • 1
  • 1
Peru
  • 2,871
  • 5
  • 37
  • 66
  • Sadly, you will have to have to do exactly that :-( – xanatos Mar 17 '15 at 11:33
  • Note that you don't have to, and in general should't, throw ObjectDisposedException in *every* method call. You only need to do so if the method depends on the unmanaged resource that has been disposed. – Joe Mar 17 '15 at 12:50
  • @Joe Am having a simple MVC function with CURD operation. But gendarme is showing the violation if i don't throw ObjectDisposedException . and it is happy if i have that line. Am i doing wrong ? – Peru Mar 18 '15 at 06:09

0 Answers0