git - libgit2sharp Repository "safe handle has been closed" -
is there problem instantiating repository object twice in same method, each time wrapped in separate using()
statement :
using(var repo = new repository({local-path}, new repositoryoptions()) { // stuff repo } // other stuff not related repo using(var repo = new repository({local-path}, new repositoryoptions()) { // more stuff repo }
for such code-block structure, in do more stuff
block i'm experiencing run-time exception safe handle has been closed
.
is there problem instantiating repository object twice in same method, each time wrapped in separate using() statement
instantiating repository
instance quite cheap, there's no problem approach.
however, 1 has keep in mind following things
objects (
reference
s,commit
s,tree
s, ..) returned through libgit2sharp library expected used during lifetime ofrepository
(ie. before it's disposed). not doing may leadobjectdisposedexception
being thrown.for performance reasons, libgit2, underlying native library lot of caching. cache purged every time
repository
disposed. such, relying on different instances ofrepository
type, may prevent 1 benefiting performance bumps.
i'm experiencing run-time exception safe handle has been closed.
this may happen if reuse in second using
block objects originate first one.
Comments
Post a Comment