File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
WebApiClientCore.Extensions.OAuths/TokenProviders Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ public TOptions GetOptionsValue<TOptions>()
5656 /// </summary>
5757 public void ClearToken ( )
5858 {
59+ this . CheckDisposed ( ) ;
5960 using ( this . asyncRoot . Lock ( ) )
6061 {
6162 this . token = null ;
@@ -68,6 +69,7 @@ public void ClearToken()
6869 /// <returns></returns>
6970 public async Task < TokenResult > GetTokenAsync ( )
7071 {
72+ this . CheckDisposed ( ) ;
7173 using ( await this . asyncRoot . LockAsync ( ) . ConfigureAwait ( false ) )
7274 {
7375 if ( this . token == null )
@@ -125,5 +127,16 @@ public override string ToString()
125127 {
126128 return this . Name ;
127129 }
130+
131+ /// <summary>
132+ /// 检查释放
133+ /// </summary>
134+ private void CheckDisposed ( )
135+ {
136+ if ( this . IsDisposed == true )
137+ {
138+ throw new ObjectDisposedException ( this . GetType ( ) . Name ) ;
139+ }
140+ }
128141 }
129142}
You can’t perform that action at this time.
0 commit comments