CoreyKaylor / Lightning.NET

.NET library for LMDB key-value store
Other
398 stars 82 forks source link

Usability - BeginTransaction() before Open() causes an access violation #65

Closed nblumhardt closed 8 years ago

nblumhardt commented 8 years ago

If LightningEnvironment.BeginTransaction() is called before Open() a crash results.

            var env = new LightningEnvironment("C:\\Somewhere");
            env.MapSize = 12345;
            env.BeginTransaction();

I know there are probably many places where the library or LMDB might behave this way, but since this one is "right at the start" and may discourage new users it seems like checking Environment.IsOpen in BeginTransaction() and throwing appropriately would be worthwhile.

CoreyKaylor commented 8 years ago

I agree, I'll plan for this change as well when I get to my next round of updates.