<ExcludeList Include="$(XunitTestBinBase)/tracing/tracecontrol/tracecontrol/*">
<Issue>20299</Issue>
</ExcludeList>
- <ExcludeList Include="$(XunitTestBinBase)/Interop/NativeLibraryResolveEvent/ResolveEventTests/*">
- <Issue>23941</Issue>
- </ExcludeList>
- <ExcludeList Include="$(XunitTestBinBase)/Interop/NativeLibraryResolveCallback/CallbackTests/*">
- <Issue>23941</Issue>
- </ExcludeList>
<ExcludeList Include="$(XunitTestBinBase)/Interop/IJW/CopyConstructorMarshaler/CopyConstructorMarshaler/*">
<Issue>23358</Issue>
</ExcludeList>
<ExcludeList Include="$(XunitTestBinBase)/Interop/IJW/NativeCallingManaged/NativeCallingManaged/*">
<Issue>23358</Issue>
</ExcludeList>
- <ExcludeList Include="$(XunitTestBinBase)/Interop/NativeLibraryResolveCallback/CallbackStressTest/*">
- <Issue>24305</Issue>
- </ExcludeList>
</ItemGroup>
<!-- All Unix targets -->
[assembly: DefaultDllImportSearchPaths(DllImportSearchPath.SafeDirectories)]
public class CallbackStressTest
{
- static volatile bool s_RunGC = true;
-
- static int s_LoopCounter = 25;
+ static int s_LoopCounter = 10;
static int s_FinallyCalled = 0;
static int s_CatchCalled = 0;
static int s_OtherExceptionCatchCalled = 0;
static int s_WrongPInvokesExecuted = 0;
static int s_PInvokesExecuted = 0;
- public static void Collector()
- {
- while(s_RunGC) GC.Collect();
- }
[MethodImpl(MethodImplOptions.NoInlining)]
public static void SetResolve()
{
RaiseException(5, 0, 0, IntPtr.Zero);
}
- catch(SEHException ex) { s_SEHExceptionCatchCalled++; }
+ catch(SEHException ex) { GC.Collect(); s_SEHExceptionCatchCalled++; }
#else
// TODO: test on Unix when implementing pinvoke inlining
s_SEHExceptionCatchCalled++;
public static int Main()
{
- new Thread(Collector).Start();
-
for(int i = 0; i < s_LoopCounter; i++)
{
try
NativeSum(10, 10);
s_WrongPInvokesExecuted++;
}
- catch (DllNotFoundException) { s_CatchCalled++; }
+ catch (DllNotFoundException) { GC.Collect(); s_CatchCalled++; }
try { DoCall(); }
- catch (DllNotFoundException) { s_CatchCalled++; }
+ catch (DllNotFoundException) { GC.Collect(); s_CatchCalled++; }
try { DoCallTryFinally(); }
- catch (DllNotFoundException) { s_CatchCalled++; }
+ catch (DllNotFoundException) { GC.Collect(); s_CatchCalled++; }
try { DoCallTryCatch(true); }
- catch (ArgumentException) { s_OtherExceptionCatchCalled++; }
+ catch (ArgumentException) { GC.Collect(); s_OtherExceptionCatchCalled++; }
try { DoCallTryRethrowInCatch(); }
- catch (DllNotFoundException) { s_CatchCalled++; }
+ catch (DllNotFoundException) { GC.Collect(); s_CatchCalled++; }
try { DoCallTryRethrowDifferentExceptionInCatch(); }
- catch (InvalidOperationException) { s_OtherExceptionCatchCalled++; }
+ catch (InvalidOperationException) { GC.Collect(); s_OtherExceptionCatchCalled++; }
ManualRaiseException();
}
s_PInvokesExecuted += (a == b && a == 20)? 2 : 0;
try { DoCallTryCatch(false); }
- catch (ArgumentException) { s_OtherExceptionCatchCalled++; }
+ catch (ArgumentException) { GC.Collect(); s_OtherExceptionCatchCalled++; }
ManualRaiseException();
}
- s_RunGC = false;
-
if (s_FinallyCalled == s_LoopCounter &&
s_CatchCalled == (s_LoopCounter * 7) &&
s_OtherExceptionCatchCalled == (s_LoopCounter * 3) &&