Skip to content

Commit f934150

Browse files
authored
Add missing OperationCanceledException in async code where required
- Update AsyncGenerator to 0.8.2.4 Fixes #1672
1 parent e87efc6 commit f934150

30 files changed

+62
-1
lines changed

Tools/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<package id="NUnit.Extension.NUnitV2ResultWriter" version="3.6.0" targetFramework="net461" />
88
<package id="NUnit.Extension.TeamCityEventListener" version="1.0.2" targetFramework="net461" />
99
<package id="NUnit.Extension.VSProjectLoader" version="3.6.0" targetFramework="net461" />
10-
<package id="CSharpAsyncGenerator.CommandLine" version="0.8.2.1" targetFramework="net461" />
10+
<package id="CSharpAsyncGenerator.CommandLine" version="0.8.2.4" targetFramework="net461" />
1111
<package id="vswhere" version="2.1.4" targetFramework="net461" />
1212
<package id="gitreleasemanager" version="0.7.0" targetFramework="net461" />
1313
</packages>

src/NHibernate.Test/Async/Cascade/Circle/MultiPathCircleCascadeTest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ public async Task MergeEntityWithNonNullableEntityNullAsync()
155155
await (session.MergeAsync(route, cancellationToken));
156156
Assert.Fail("should have thrown an exception");
157157
}
158+
catch (OperationCanceledException) { throw; }
158159
catch (Exception ex)
159160
{
160161
Assert.That(ex, Is.TypeOf(typeof(PropertyValueException)));

src/NHibernate.Test/Async/DebugConnectionProvider.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public override async Task<DbConnection> GetConnectionAsync(CancellationToken ca
3030
connections.TryAdd(connection, 0);
3131
return connection;
3232
}
33+
catch (OperationCanceledException) { throw; }
3334
catch (Exception e)
3435
{
3536
throw new HibernateException("Could not open connection to: " + ConnectionString, e);

src/NHibernate/Async/AdoNet/AbstractBatcher.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ public async Task<int> ExecuteNonQueryAsync(DbCommand cmd, CancellationToken can
123123
{
124124
return await (cmd.ExecuteNonQueryAsync(cancellationToken)).ConfigureAwait(false);
125125
}
126+
catch (OperationCanceledException) { throw; }
126127
catch (Exception e)
127128
{
128129
e.Data["actual-sql-query"] = cmd.CommandText;
@@ -150,6 +151,7 @@ public virtual async Task<DbDataReader> ExecuteReaderAsync(DbCommand cmd, Cancel
150151
{
151152
reader = await (cmd.ExecuteReaderAsync(cancellationToken)).ConfigureAwait(false);
152153
}
154+
catch (OperationCanceledException) { throw; }
153155
catch (Exception e)
154156
{
155157
e.Data["actual-sql-query"] = cmd.CommandText;

src/NHibernate/Async/Collection/Generic/PersistentGenericIdentifierBag.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ public override async Task PreInsertAsync(ICollectionPersister persister, Cancel
193193
}
194194
}
195195
}
196+
catch (OperationCanceledException) { throw; }
196197
catch (Exception sqle)
197198
{
198199
throw new ADOException("Could not generate idbag row id.", sqle);

src/NHibernate/Async/Connection/DriverConnectionProvider.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public override async Task<DbConnection> GetConnectionAsync(CancellationToken ca
3939
conn.ConnectionString = ConnectionString;
4040
await (conn.OpenAsync(cancellationToken)).ConfigureAwait(false);
4141
}
42+
catch (OperationCanceledException) { throw; }
4243
catch (Exception)
4344
{
4445
conn.Dispose();

src/NHibernate/Async/Context/ThreadLocalSessionContext.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@ private static async Task CleanupAnyOrphanedSessionAsync(ISessionFactory factory
3838
{
3939
await (orphan.Transaction.RollbackAsync(cancellationToken)).ConfigureAwait(false);
4040
}
41+
catch (OperationCanceledException) { throw; }
4142
catch (Exception ex)
4243
{
4344
log.Debug(ex, "Unable to rollback transaction for orphaned session");
4445
}
4546
}
4647
orphan.Close();
4748
}
49+
catch (OperationCanceledException) { throw; }
4850
catch (Exception ex)
4951
{
5052
log.Debug(ex, "Unable to close orphaned session");

src/NHibernate/Async/Dialect/Lock/SelectLockingStrategy.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public async Task LockAsync(object id, object version, object obj, ISessionImple
6464
session.Batcher.CloseCommand(st, rs);
6565
}
6666
}
67+
catch (OperationCanceledException) { throw; }
6768
catch (HibernateException)
6869
{
6970
// Do not call Convert on HibernateExceptions

src/NHibernate/Async/Driver/NDataReader.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public static async Task<NDataReader> CreateAsync(DbDataReader reader, bool isMi
6060

6161
dataReader.results = resultList.ToArray();
6262
}
63+
catch (OperationCanceledException) { throw; }
6364
catch (Exception e)
6465
{
6566
throw new ADOException("There was a problem converting an DbDataReader to NDataReader", e);

src/NHibernate/Async/Engine/Query/NativeSQLQueryPlan.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public async Task<int> PerformExecuteUpdateAsync(QueryParameters queryParameters
9696
}
9797
}
9898
}
99+
catch (OperationCanceledException) { throw; }
99100
catch (HibernateException)
100101
{
101102
throw;

0 commit comments

Comments
 (0)