question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dispose Context after each Scenario if Context implements IDisposable

See original GitHub issue

Description

As far as I can tell and see in debugging, context objects are never disposed.

I believe it is possible to manually do this in xUnit2 by not using the automatic .WithContext<T>() method, but providing an instance and later disposing of it, but that isn’t as nice and leaves room for errors.

My scenarios use a local server for testing API round trips. The server is started and destroyed on each call to clean the slate as it were.

Progress

  • Implement scenario context disposing,
  • Implement step context disposing,
  • Implement context disposal exception propagation,
  • Ensured backward-compatibility,
  • Ensured good debugging experience

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
aidapsibrcommented, Dec 31, 2017

Will do, thanks for the quick turn around, nobody but us is geeking out on NYE haha

0reactions
aidapsibrcommented, Jan 17, 2018

I’ll be upgrading! Great quality of life upgrade thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

dbcontext - Entity Framework and calling context.dispose()
As some people commented, an exception to this rule is when a context is part of a component that implements IDisposable itself and...
Read more >
Do I always have to call Dispose() on my DbContext objects ...
Even though it does implement IDisposable, it only implements it so you can call Dispose as a safeguard in some special cases. By...
Read more >
Dispose Pattern - Framework Design Guidelines
IDisposable interface and declaring the Dispose(bool) method that implements all resource cleanup logic to be shared between the Dispose method ...
Read more >
Is it OK to create an Entity Framework DataContext object ...
Although the DbContext implements IDisposable , you shouldn't manually dispose it, nor should you wrap it in a using statement.
Read more >
IDisposable Interface (System)
The following example demonstrates how to create a resource class that implements the IDisposable interface. #using <System.dll> #using <System.Windows.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found