Skip to content

Commit da7b112

Browse files
NH-3023 - Test case for pool corruption after deadlock
1 parent 032769d commit da7b112

File tree

13 files changed

+924
-2
lines changed

13 files changed

+924
-2
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
//------------------------------------------------------------------------------
2+
// <auto-generated>
3+
// This code was generated by AsyncGenerator.
4+
//
5+
// Changes to this file may cause incorrect behavior and will be lost if
6+
// the code is regenerated.
7+
// </auto-generated>
8+
//------------------------------------------------------------------------------
9+
10+
11+
using System;
12+
using System.Diagnostics;
13+
using System.IO;
14+
using NUnit.Framework;
15+
16+
namespace NHibernate.Test.DynamicProxyTests
17+
{
18+
using System.Threading.Tasks;
19+
20+
/// <content>
21+
/// Contains generated async methods
22+
/// </content>
23+
24+
public partial class PeVerifier
25+
{
26+
27+
public async Task AssertIsValidAsync()
28+
{
29+
var process = new Process
30+
{
31+
StartInfo =
32+
{
33+
FileName = _peVerifyPath,
34+
RedirectStandardOutput = true,
35+
UseShellExecute = false,
36+
Arguments = "\"" + _assemlyLocation + "\" /VERBOSE",
37+
CreateNoWindow = true
38+
}
39+
};
40+
41+
process.Start();
42+
var processOutput = await (process.StandardOutput.ReadToEndAsync());
43+
process.WaitForExit();
44+
45+
var result = process.ExitCode + " code ";
46+
47+
if (process.ExitCode != 0)
48+
Assert.Fail("PeVerify reported error(s): " + Environment.NewLine + processOutput, result);
49+
}
50+
}
51+
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
//------------------------------------------------------------------------------
2+
// <auto-generated>
3+
// This code was generated by AsyncGenerator.
4+
//
5+
// Changes to this file may cause incorrect behavior and will be lost if
6+
// the code is regenerated.
7+
// </auto-generated>
8+
//------------------------------------------------------------------------------
9+
10+
11+
using System;
12+
using System.IO;
13+
using System.Reflection;
14+
using System.Reflection.Emit;
15+
using NUnit.Framework;
16+
using NHibernate.Proxy.DynamicProxy;
17+
18+
namespace NHibernate.Test.DynamicProxyTests
19+
{
20+
using System.Threading.Tasks;
21+
/// <content>
22+
/// Contains generated async methods
23+
/// </content>
24+
public partial class PeVerifyFixture
25+
{
26+
27+
[Test]
28+
public Task VerifyClassWithPublicConstructorAsync()
29+
{
30+
try
31+
{
32+
var factory = new ProxyFactory(new SavingProxyAssemblyBuilder(assemblyName));
33+
var proxyType = factory.CreateProxyType(typeof(ClassWithPublicDefaultConstructor), null);
34+
35+
wasCalled = false;
36+
Activator.CreateInstance(proxyType);
37+
38+
Assert.That(wasCalled);
39+
return new PeVerifier(assemblyFileName).AssertIsValidAsync();
40+
}
41+
catch (Exception ex)
42+
{
43+
return Task.FromException<object>(ex);
44+
}
45+
}
46+
47+
[Test]
48+
public Task VerifyClassWithProtectedConstructorAsync()
49+
{
50+
try
51+
{
52+
var factory = new ProxyFactory(new SavingProxyAssemblyBuilder(assemblyName));
53+
var proxyType = factory.CreateProxyType(typeof(ClassWithProtectedDefaultConstructor), null);
54+
55+
wasCalled = false;
56+
Activator.CreateInstance(proxyType);
57+
58+
Assert.That(wasCalled);
59+
return new PeVerifier(assemblyFileName).AssertIsValidAsync();
60+
}
61+
catch (Exception ex)
62+
{
63+
return Task.FromException<object>(ex);
64+
}
65+
}
66+
67+
#region PeVerifyTypes
68+
69+
#endregion
70+
#region ProxyFactory.IProxyAssemblyBuilder
71+
72+
#endregion
73+
}
74+
}

0 commit comments

Comments
 (0)