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
After Container.Dispose(), the container should throw ObjectDisposedException, not NullReferenceException #304
After Container.Dispose(), the container should throw ObjectDisposedException, not NullReferenceException #304
Conversation
…etons" parameter.
…ients" parameter.
The Since I haven't been able to reproduce the problem in a test yet, I assume the plugin graph is in some way to blame for the |
…uilder(PluginGraph) constructor.
Ah. I see now that |
…w ObjectDisposedException.
…Arguments) if the container is disposed.
…Arguments, String) if the container is disposed.
…icitArguments) if the container is disposed.
…tArguments) if the container is disposed.
…e container is disposed.
…if the container is disposed.
…g) if the container is disposed.
…tainer is disposed.
…ontainer is disposed.
…) if the container is disposed.
…container is disposed.
…the container is disposed.
…, String, String) if the container is disposed.
…container is disposed.
…() if the container is disposed.
…f the container is disposed.
…e container is disposed.
…ontainer is disposed.
…e container is disposed.
… if the container is disposed.
…nType) if the container is disposed.
…e container is disposed.
I've added checks for |
I'm thinking that the container perhaps should have a |
Conflicts: src/StructureMap.Testing/Pipeline/NestedContainerSupportTester.cs src/StructureMap/Container.cs src/StructureMap/PluginGraphBuilder.cs
Seems like this was fixed in 516d323. Closing. |
I've not been able to reproduce this in a test, but given a rather complex plugin graph, I've discovered that resolving certain concrete, unregistered types, causes the
SessionCache
to throw aNullReferenceException
.This pull request tries to remedy this a bit by adding null-guards for all the objects that are involved in the given scenario. I've verified that these guards cause
ArgumentNullException
to be thrown instead, which is an improvement, but I've not been able to figure out the root of the problem yet.The exception itself looks like this:
After introducing the null-guards and catching the
ArgumentNullException
being thrown (with Debug > Exceptions in Visual Studio), I've managed to sew together this call stack:I wish I had a test case and a fix, but the plugin graph this happens on is so complex that it will take time to reproduce it. In the meantime I hope leaving this here might give someone an idea. In any case, all unit tests still pass, so merging these null-guards should be safe and an improvement anyway.