I took the static code analyzer for a quick spin (vs2010)
I created a custom ruleset containing warnings about "IDisposable" (and nothing else) for tvservice and tvlib projects.
results =>
tvservice:
tvlib:
we should get rid of those asap :=)
you can try the attached ruleset in vs2010.
I've fixed tvlib and will work on tvservice later.
will post patch soon.
/gibman
I created a custom ruleset containing warnings about "IDisposable" (and nothing else) for tvservice and tvlib projects.
results =>
tvservice:
Code:
Warning 398 CA1001 : Microsoft.Design : Implement IDisposable on 'DiskManagement' because it creates members of the following IDisposable types: 'Timer'. If 'DiskManagement' has previously shipped, adding new members that implement IDisposable to this type is considered a breaking change to existing consumers. C:\Development\TvEngine.clean\TVLibrary\TvService\DiskManagement\DiskManagement.cs 32 TvService
Warning 399 CA1063 : Microsoft.Design : Provide an overridable implementation of Dispose(bool) on 'EpgCard' or mark the type as sealed. A call to Dispose(false) should only clean up native resources. A call to Dispose(true) should clean up both managed and native resources. C:\Development\TvEngine.clean\TVLibrary\TvService\Epg\EpgCard.cs 36 TvService
Warning 400 CA1063 : Microsoft.Design : Modify 'EpgCard.Dispose()' so that it calls Dispose(true), then calls GC.SuppressFinalize on the current object instance ('this' or 'Me' in Visual Basic), and then returns. C:\Development\TvEngine.clean\TVLibrary\TvService\Epg\EpgCard.cs 763 TvService
Warning 402 CA1063 : Microsoft.Design : Provide an overridable implementation of Dispose(bool) on 'EpgGrabber' or mark the type as sealed. A call to Dispose(false) should only clean up native resources. A call to Dispose(true) should clean up both managed and native resources. C:\Development\TvEngine.clean\TVLibrary\TvService\Epg\EpgGrabber.cs 51 TvService
Warning 403 CA1063 : Microsoft.Design : Modify 'EpgGrabber.Dispose()' so that it calls Dispose(true), then calls GC.SuppressFinalize on the current object instance ('this' or 'Me' in Visual Basic), and then returns. C:\Development\TvEngine.clean\TVLibrary\TvService\Epg\EpgGrabber.cs 187 TvService
Warning 404 CA1001 : Microsoft.Design : Implement IDisposable on 'Recorder' because it creates members of the following IDisposable types: 'ManualResetEvent'. If 'Recorder' has previously shipped, adding new members that implement IDisposable to this type is considered a breaking change to existing consumers. C:\Development\TvEngine.clean\TVLibrary\TvService\CardManagement\CardHandler\Recorder.cs 34 TvService
Warning 405 CA1001 : Microsoft.Design : Implement IDisposable on 'RecordingManagement' because it creates members of the following IDisposable types: 'Timer'. If 'RecordingManagement' has previously shipped, adding new members that implement IDisposable to this type is considered a breaking change to existing consumers. C:\Development\TvEngine.clean\TVLibrary\TvService\DiskManagement\RecordingManagement.cs 27 TvService
Warning 410 CA2000 : Microsoft.Reliability : In method 'Service1.Main(string[])', object 's' is not disposed along all exception paths. Call System.IDisposable.Dispose on object 's' before all references to it are out of scope. C:\Development\TvEngine.clean\TVLibrary\TvService\Service1.cs 133 TvService
Warning 411 CA2000 : Microsoft.Reliability : In method 'Service1.Main(string[])', call System.IDisposable.Dispose on object 'ti' before all references to it are out of scope. C:\Development\TvEngine.clean\TVLibrary\TvService\Service1.cs 105 TvService
Warning 412 CA2000 : Microsoft.Reliability : In method 'Service1.Main(string[])', call System.IDisposable.Dispose on object 'ti' before all references to it are out of scope. C:\Development\TvEngine.clean\TVLibrary\TvService\Service1.cs 118 TvService
Warning 413 CA1001 : Microsoft.Design : Implement IDisposable on 'TimeShifter' because it creates members of the following IDisposable types: 'ManualResetEvent'. If 'TimeShifter' has previously shipped, adding new members that implement IDisposable to this type is considered a breaking change to existing consumers. C:\Development\TvEngine.clean\TVLibrary\TvService\CardManagement\CardHandler\TimeShifter.cs 33 TvService
Warning 414 CA2000 : Microsoft.Reliability : In method 'TsCopier.DoCopy()', call System.IDisposable.Dispose on object 'reader' before all references to it are out of scope. C:\Development\TvEngine.clean\TVLibrary\TvService\TsCopier.cs 75 TvService
Warning 415 CA2000 : Microsoft.Reliability : In method 'TsCopier.DoCopy()', call System.IDisposable.Dispose on object 'writer' before all references to it are out of scope. C:\Development\TvEngine.clean\TVLibrary\TvService\TsCopier.cs 76 TvService
Warning 416 CA2202 : Microsoft.Usage : Object 'reader' can be disposed more than once in method 'TsCopier.DoCopy()'. To avoid generating a System.ObjectDisposedException you should not call Dispose more than one time on an object.: Lines: 95 C:\Development\TvEngine.clean\TVLibrary\TvService\TsCopier.cs 95 TvService
Warning 417 CA2202 : Microsoft.Usage : Object 'writer' can be disposed more than once in method 'TsCopier.DoCopy()'. To avoid generating a System.ObjectDisposedException you should not call Dispose more than one time on an object.: Lines: 92 C:\Development\TvEngine.clean\TVLibrary\TvService\TsCopier.cs 92 TvService
Warning 418 CA1001 : Microsoft.Design : Implement IDisposable on 'TvCardContext' because it creates members of the following IDisposable types: 'Timer'. If 'TvCardContext' has previously shipped, adding new members that implement IDisposable to this type is considered a breaking change to existing consumers. C:\Development\TvEngine.clean\TVLibrary\TvService\TvCardContext.cs 40 TvService
Warning 419 CA1063 : Microsoft.Design : Provide an overridable implementation of Dispose(bool) on 'TVController' or mark the type as sealed. A call to Dispose(false) should only clean up native resources. A call to Dispose(true) should clean up both managed and native resources. C:\Development\TvEngine.clean\TVLibrary\TvService\TVController.cs 51 TvService
Warning 420 CA2213 : Microsoft.Usage : 'TVController' contains field 'TVController._epgGrabber' that is of IDisposable type: 'EpgGrabber'. Change the Dispose method on 'TVController' to call Dispose or Close on this field. C:\Development\TvEngine.clean\TVLibrary\TvService\TVController.cs 824 TvService
Warning 421 CA1063 : Microsoft.Design : Modify 'TVController.Dispose()' so that it calls Dispose(true), then calls GC.SuppressFinalize on the current object instance ('this' or 'Me' in Visual Basic), and then returns. C:\Development\TvEngine.clean\TVLibrary\TvService\TVController.cs 824 TvService
Warning 428 CA1001 : Microsoft.Design : Implement IDisposable on 'TvServiceThread' because it creates members of the following IDisposable types: 'EventWaitHandle', 'TVController'. If 'TvServiceThread' has previously shipped, adding new members that implement IDisposable to this type is considered a breaking change to existing consumers. C:\Development\TvEngine.clean\TVLibrary\TvService\Service1.cs 287 TvService
tvlib:
Code:
Warning 367 CA2000 : Microsoft.Reliability : In method 'TvCardCollection.DetectCards()', call System.IDisposable.Dispose on object 'rotEntry' before all references to it are out of scope. C:\Development\TvEngine.clean\TVLibrary\TVLibrary\Implementations\TvCardCollection.cs 149 TVLibrary
Warning 368 CA2000 : Microsoft.Reliability : In method 'TvCardCollection.GetHash(string)', call System.IDisposable.Dispose on object 'new SHA1Managed()' before all references to it are out of scope. C:\Development\TvEngine.clean\TVLibrary\TVLibrary\Implementations\TvCardCollection.cs 483 TVLibrary
Warning 369 CA2000 : Microsoft.Reliability : In method 'TvCardAnalog.BuildGraph()', object '_hauppauge' is not disposed along all exception paths. Call System.IDisposable.Dispose on object '_hauppauge' before all references to it are out of scope. C:\Development\TvEngine.clean\TVLibrary\TVLibrary\Implementations\Analog\Graphs\Analog\TvCardAnalog.cs 624 TVLibrary
Warning 370 CA2213 : Microsoft.Usage : 'ConditionalAccess' contains field 'ConditionalAccess._DigitalDevices' that is of IDisposable type: 'DigitalDevices'. Change the Dispose method on 'ConditionalAccess' to call Dispose or Close on this field. C:\Development\TvEngine.clean\TVLibrary\TVLibrary\Implementations\DVB\ConditionalAccess\ConditionalAccess.cs 1089 TVLibrary
Warning 371 CA2213 : Microsoft.Usage : 'ConditionalAccess' contains field 'ConditionalAccess._TeVii' that is of IDisposable type: 'TeVii'. Change the Dispose method on 'ConditionalAccess' to call Dispose or Close on this field. C:\Development\TvEngine.clean\TVLibrary\TVLibrary\Implementations\DVB\ConditionalAccess\ConditionalAccess.cs 1089 TVLibrary
Warning 372 CA2213 : Microsoft.Usage : 'ConditionalAccess' contains field 'ConditionalAccess._conexant' that is of IDisposable type: 'ConexantBDA'. Change the Dispose method on 'ConditionalAccess' to call Dispose or Close on this field. C:\Development\TvEngine.clean\TVLibrary\TVLibrary\Implementations\DVB\ConditionalAccess\ConditionalAccess.cs 1089 TVLibrary
Warning 373 CA2213 : Microsoft.Usage : 'ConditionalAccess' contains field 'ConditionalAccess._digitalEveryWhere' that is of IDisposable type: 'DigitalEverywhere'. Change the Dispose method on 'ConditionalAccess' to call Dispose or Close on this field. C:\Development\TvEngine.clean\TVLibrary\TVLibrary\Implementations\DVB\ConditionalAccess\ConditionalAccess.cs 1089 TVLibrary
Warning 374 CA2213 : Microsoft.Usage : 'ConditionalAccess' contains field 'ConditionalAccess._genericbdas' that is of IDisposable type: 'GenericBDAS'. Change the Dispose method on 'ConditionalAccess' to call Dispose or Close on this field. C:\Development\TvEngine.clean\TVLibrary\TVLibrary\Implementations\DVB\ConditionalAccess\ConditionalAccess.cs 1089 TVLibrary
Warning 375 CA2213 : Microsoft.Usage : 'ConditionalAccess' contains field 'ConditionalAccess._genpix' that is of IDisposable type: 'GenPixBDA'. Change the Dispose method on 'ConditionalAccess' to call Dispose or Close on this field. C:\Development\TvEngine.clean\TVLibrary\TVLibrary\Implementations\DVB\ConditionalAccess\ConditionalAccess.cs 1089 TVLibrary
Warning 376 CA2213 : Microsoft.Usage : 'ConditionalAccess' contains field 'ConditionalAccess._hauppauge' that is of IDisposable type: 'Hauppauge'. Change the Dispose method on 'ConditionalAccess' to call Dispose or Close on this field. C:\Development\TvEngine.clean\TVLibrary\TVLibrary\Implementations\DVB\ConditionalAccess\ConditionalAccess.cs 1089 TVLibrary
Warning 377 CA2213 : Microsoft.Usage : 'ConditionalAccess' contains field 'ConditionalAccess._isgenericatsc' that is of IDisposable type: 'GenericATSC'. Change the Dispose method on 'ConditionalAccess' to call Dispose or Close on this field. C:\Development\TvEngine.clean\TVLibrary\TVLibrary\Implementations\DVB\ConditionalAccess\ConditionalAccess.cs 1089 TVLibrary
Warning 378 CA2213 : Microsoft.Usage : 'ConditionalAccess' contains field 'ConditionalAccess._isvixsatsc' that is of IDisposable type: 'ViXSATSC'. Change the Dispose method on 'ConditionalAccess' to call Dispose or Close on this field. C:\Development\TvEngine.clean\TVLibrary\TVLibrary\Implementations\DVB\ConditionalAccess\ConditionalAccess.cs 1089 TVLibrary
Warning 379 CA2213 : Microsoft.Usage : 'ConditionalAccess' contains field 'ConditionalAccess._knc' that is of IDisposable type: 'KNCAPI'. Change the Dispose method on 'ConditionalAccess' to call Dispose or Close on this field. C:\Development\TvEngine.clean\TVLibrary\TVLibrary\Implementations\DVB\ConditionalAccess\ConditionalAccess.cs 1089 TVLibrary
Warning 380 CA2213 : Microsoft.Usage : 'ConditionalAccess' contains field 'ConditionalAccess._profred' that is of IDisposable type: 'ProfRed'. Change the Dispose method on 'ConditionalAccess' to call Dispose or Close on this field. C:\Development\TvEngine.clean\TVLibrary\TVLibrary\Implementations\DVB\ConditionalAccess\ConditionalAccess.cs 1089 TVLibrary
Warning 381 CA2213 : Microsoft.Usage : 'ConditionalAccess' contains field 'ConditionalAccess._technoTrend' that is of IDisposable type: 'TechnoTrendAPI'. Change the Dispose method on 'ConditionalAccess' to call Dispose or Close on this field. C:\Development\TvEngine.clean\TVLibrary\TVLibrary\Implementations\DVB\ConditionalAccess\ConditionalAccess.cs 1089 TVLibrary
Warning 382 CA2213 : Microsoft.Usage : 'ConditionalAccess' contains field 'ConditionalAccess._twinhan' that is of IDisposable type: 'Twinhan'. Change the Dispose method on 'ConditionalAccess' to call Dispose or Close on this field. C:\Development\TvEngine.clean\TVLibrary\TVLibrary\Implementations\DVB\ConditionalAccess\ConditionalAccess.cs 1089 TVLibrary
Warning 383 CA2213 : Microsoft.Usage : 'ConditionalAccess' contains field 'ConditionalAccess._winTvCiModule' that is of IDisposable type: 'WinTvCiModule'. Change the Dispose method on 'ConditionalAccess' to call Dispose or Close on this field. C:\Development\TvEngine.clean\TVLibrary\TVLibrary\Implementations\DVB\ConditionalAccess\ConditionalAccess.cs 1089 TVLibrary
Warning 384 CA2213 : Microsoft.Usage : 'TvCardDvbBase' contains field 'TvCardDvbBase.winTvCiHandler' that is of IDisposable type: 'WinTvCiModule'. Change the Dispose method on 'TvCardDvbBase' to call Dispose or Close on this field. C:\Development\TvEngine.clean\TVLibrary\TVLibrary\Implementations\DVB\Graphs\TvCardDvbBase.cs 1910 TVLibrary
Warning 385 CA2215 : Microsoft.Usage : Ensure that method 'TvCardDvbSS2.Dispose()' calls base.'TvCardDvbSS2.Dispose()' in all possible control flow paths. C:\Development\TvEngine.clean\TVLibrary\TVLibrary\Implementations\DVB\Graphs\SS2\TvCardDvbSS2.cs 1161 TVLibrary
Warning 386 CA2000 : Microsoft.Reliability : In method 'RtspStreaming.GetDefGatewayNetAddresses()', call System.IDisposable.Dispose on object 'searcher' before all references to it are out of scope. C:\Development\TvEngine.clean\TVLibrary\TVLibrary\Streaming\RtspStreaming.cs 375 TVLibrary
Warning 387 CA2000 : Microsoft.Reliability : In method 'TeletextPageRenderer.Render(Graphics, byte, int, ref int, ref int, int, int, int)', object 'backBrush' is not disposed along all exception paths. Call System.IDisposable.Dispose on object 'backBrush' before all references to it are out of scope. C:\Development\TvEngine.clean\TVLibrary\TVLibrary\Teletext\Implementations\TeletextPageRenderer.cs 404 TVLibrary
Warning 388 CA2000 : Microsoft.Reliability : In method 'TeletextPageRenderer.Render(Graphics, byte, int, ref int, ref int, int, int, int)', object 'backPen' is not disposed along all exception paths. Call System.IDisposable.Dispose on object 'backPen' before all references to it are out of scope. C:\Development\TvEngine.clean\TVLibrary\TVLibrary\Teletext\Implementations\TeletextPageRenderer.cs 406 TVLibrary
Warning 389 CA2000 : Microsoft.Reliability : In method 'TeletextPageRenderer.Render(Graphics, byte, int, ref int, ref int, int, int, int)', object 'foreBrush' is not disposed along all exception paths. Call System.IDisposable.Dispose on object 'foreBrush' before all references to it are out of scope. C:\Development\TvEngine.clean\TVLibrary\TVLibrary\Teletext\Implementations\TeletextPageRenderer.cs 405 TVLibrary
we should get rid of those asap :=)
you can try the attached ruleset in vs2010.
I've fixed tvlib and will work on tvservice later.
will post patch soon.
/gibman
Ethiopia