Skip to content

Commit aa5fb43

Browse files
authored
Fix some UnobservedTaskException errors
Removed method which was not called anymore. Added override method which handles the StateMaanger.Exited use case explicitly.
1 parent e83a4ac commit aa5fb43

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

lib/PuppeteerSharp/States/DisposedState.cs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,19 @@ public DisposedState(StateManager stateManager) : base(stateManager)
99
{
1010
}
1111

12-
public void EnterFrom(LauncherBase p, State fromState)
12+
public override Task EnterFromAsync(LauncherBase p, State fromState, TimeSpan timeSpan)
1313
{
14-
if (!StateManager.TryEnter(p, fromState, this))
14+
if (fromState == StateManager.Exited)
1515
{
16-
// Delegate Dispose to current state, because it has already changed since
17-
// transition to this state was initiated.
18-
StateManager.CurrentState.Dispose(p);
16+
return null;
1917
}
20-
else if (fromState != StateManager.Exited)
21-
{
22-
Kill(p);
2318

24-
p.ExitCompletionSource.TrySetException(new ObjectDisposedException(p.ToString()));
25-
p.TempUserDataDir?.Dispose();
26-
}
19+
Kill(p);
20+
21+
p.ExitCompletionSource.TrySetException(new ObjectDisposedException(p.ToString()));
22+
p.TempUserDataDir?.Dispose();
23+
24+
return null;
2725
}
2826

2927
public override Task StartAsync(LauncherBase p) => throw new ObjectDisposedException(p.ToString());

0 commit comments

Comments
 (0)