Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception during execution of AsyncTests.Imported_AsyncWithEH terminates test process #72437

Open
sharwell opened this issue Mar 7, 2024 · 0 comments
Labels
Area-Infrastructure untriaged Issues and PRs which have not yet been triaged by a lead

Comments

@sharwell
Copy link
Member

sharwell commented Mar 7, 2024

The following method appears to be at fault for a TestHost crash in https://dev.azure.com/dnceng-public/public/_build/results?buildId=593505&view=ms.vss-test-web.build-test-results-tab&runId=14348754&resultId=165403&paneView=dotnet-dnceng.dnceng-build-release-tasks.helix-test-information-tab.

The crash dump indicates a NullReferenceException was thrown within an AsyncVoidMethodBuilder leading to a process crash.

<Fact,
WorkItem(94940, "https://devdiv.visualstudio.com/defaultcollection/DevDiv/_workitems#_a=edit&id=94940"),
WorkItem(785170, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/785170")>
Public Sub Imported_AsyncWithEH()
CompileAndVerify(
<compilation>
<file name="a.vb">
Imports System
Imports System.Threading
Imports System.Threading.Tasks
Module Module1
Dim awaitCount As Integer = 0
Dim finallyCount As Integer = 0
Sub LogAwait()
awaitCount += 1
End Sub
Sub LogException()
finallyCount += 1
End Sub
Public Async Sub F(handle As AutoResetEvent)
Await Task.Factory.StartNew(AddressOf LogAwait)
Try
Await Task.Factory.StartNew(AddressOf LogAwait)
Try
Await Task.Factory.StartNew(AddressOf LogAwait)
Try
Await Task.Factory.StartNew(AddressOf LogAwait)
Throw New Exception()
Catch ex As Exception
Finally
LogException()
End Try
Await Task.Factory.StartNew(AddressOf LogAwait)
Throw New Exception()
Catch ex As Exception
Finally
LogException()
End Try
Await Task.Factory.StartNew(AddressOf LogAwait)
Throw New Exception()
Catch ex As Exception
Finally
LogException()
End Try
Await Task.Factory.StartNew(AddressOf LogAwait)
handle.Set()
End Sub
Public Sub Main2(i As Integer)
awaitCount = 0
finallyCount = 0
Dim handle As New AutoResetEvent(False)
F(handle)
Dim completed = handle.WaitOne(4000)
If completed Then
If Not (awaitCount = 7 And finallyCount = 3) Then
Throw New Exception("failed at " &amp; i)
End If
Else
Throw New Exception("did not complete in time: " &amp; i)
End If
End Sub
Public Sub Main()
For i As Integer = 0 To 2000
Main2(i)
Next
End Sub
End Module
</file>
</compilation>, useLatestFramework:=True, expectedOutput:="")
End Sub

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Infrastructure untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

No branches or pull requests

1 participant