Although the topic has been discussed here before, the proposed solutions do not seem to work.
I have a click-click-callback method in my form application that displays a folder selection dialog:
private void ButtonSelectReporterFolderClick(object sender, EventArgs e) { using (var dialog = new FolderBrowserDialog())
This raises a warning:
CA2000: Microsoft.Reliability : In method 'MainWindow.ButtonSelectReporterFolderClick(object, EventArgs)', object '<>g__initLocal' is not disposed along all exception paths. Call System.IDisposable.Dispose on object '<>g__initLocal' before all references to it are out of scope.
I also tried using a try - finally block or even a call. Do not use any blocks, all to no avail - the warning always remains in the initialization line.
Efrain
source share