1- // ***
2- // *** Copyright(C) 2017-2021, Daniel M. Porrey. All rights reserved.
3- // **
4- // *** This program is free software: you can redistribute it and/or modify
5- // *** it under the terms of the GNU Lesser General Public License as published
6- // *** by the Free Software Foundation, either version 3 of the License, or
7- // *** (at your option) any later version.
8- // ***
9- // *** This program is distributed in the hope that it will be useful,
10- // *** but WITHOUT ANY WARRANTY; without even the implied warranty of
11- // *** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12- // *** GNU Lesser General Public License for more details.
13- // ***
14- // *** You should have received a copy of the GNU Lesser General Public License
15- // *** along with this program. If not, see http://www.gnu.org/licenses/.
16- // ***
17- #if ( NET5_0 || NET6_0 )
1+ //
2+ // Copyright(C) 2017-2021, Daniel M. Porrey. All rights reserved.
3+ //
4+ // This program is free software: you can redistribute it and/or modify
5+ // it under the terms of the GNU Lesser General Public License as published
6+ // by the Free Software Foundation, either version 3 of the License, or
7+ // (at your option) any later version.
8+ //
9+ // This program is distributed in the hope that it will be useful,
10+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
11+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+ // GNU Lesser General Public License for more details.
13+ //
14+ // You should have received a copy of the GNU Lesser General Public License
15+ // along with this program. If not, see http://www.gnu.org/licenses/.
16+ //
1817using System . Diagnostics ;
1918using System . Threading . Tasks ;
2019
@@ -34,9 +33,9 @@ public abstract class AsyncDisposableObject : DisposableObject, IAsyncDisposable
3433 /// </summary>
3534 public AsyncDisposableObject ( )
3635 {
37- // ***
38- // *** Set this to True for debugging.
39- // ***
36+ //
37+ // Set this to True for debugging.
38+ //
4039 this . AssertWhenNotDisposed = false ;
4140 }
4241
@@ -45,25 +44,25 @@ public AsyncDisposableObject()
4544 /// </summary>
4645 ~ AsyncDisposableObject ( )
4746 {
48- // ***
49- // *** Write a trace (to the debugger) showing this method was called (it will only
50- // *** get called if this object is not Disposed).
51- // ***
47+ //
48+ // Write a trace (to the debugger) showing this method was called (it will only
49+ // get called if this object is not Disposed).
50+ //
5251 Trace . TraceWarning ( "~BaseObject called on {0}" , this . OnGetClassName ( ) ) ;
5352
54- // ***
55- // *** Give the parent object a chance to respond, if not then this
56- // *** class will assert.
57- // ***
53+ //
54+ // Give the parent object a chance to respond, if not then this
55+ // class will assert.
56+ //
5857 if ( this . AssertWhenNotDisposed )
5958 {
6059 if ( ! this . OnNotDisposedProperly ( ) )
6160 {
62- // ***
63- // *** Assert if this object is destroyed without being disposed. Even though
64- // *** dispose is called here, it is more ideal that it be called by the user
65- // *** of the object. This assert will help catch this instance.
66- // ***
61+ //
62+ // Assert if this object is destroyed without being disposed. Even though
63+ // dispose is called here, it is more ideal that it be called by the user
64+ // of the object. This assert will help catch this instance.
65+ //
6766 Trace . Assert ( this . IsDisposed , this . OnGetClassName ( ) + " was not disposed properly." ) ;
6867 }
6968 else
@@ -72,11 +71,11 @@ public AsyncDisposableObject()
7271 }
7372 }
7473
75- // ***
76- // *** This destructor is only called by garbage collection. Because of this, this object
77- // *** can no longer access managed objects. Only unmanaged objects will be cleaned up
78- // *** here.
79- // ***
74+ //
75+ // This destructor is only called by garbage collection. Because of this, this object
76+ // can no longer access managed objects. Only unmanaged objects will be cleaned up
77+ // here.
78+ //
8079 this . Dispose ( false ) ;
8180 }
8281
@@ -91,5 +90,4 @@ public virtual ValueTask DisposeAsync()
9190 return ValueTask . CompletedTask ;
9291 }
9392 }
94- }
95- #endif
93+ }
0 commit comments