nunit-console
nunit-console copied to clipboard
Engine should not crash on encountering assembly that cannot be examined
See https://github.com/nunit/nunit-console/issues/794.
Currently, if the engine is passed an assembly that it cannot examine, the engine throws an exception. This was the correct behaviour at the time of implementation, however our handling of invalid assemblies has since improved.
We should instead suppress the crash, and create some form of NotRunnableFrameworkDriver for the assembly. That will allow the engine and various runners to produce more user-friendly error messages for these cases.
Interesting. Our DriverService already does what you suggest in the face of a BadImageFormatException.
But this exception comes in the code that initially examines the assembly in order to select a runner and the DriverService isn't in play until we have a runner that needs to create a driver.
I'm pretty sure this worked in the past but we have added more pre-checks to the code before we actually try to load the assembly and probably that's what broke it.
What I'm not getting is why this doesn't happen for Run as well as Explore.
I think I does happen for run as well. 🙂
Ah. That would make sense. I think we should go through all the "pre-discovery" we do with Cecil and try to handle errors in a more friendly way.
In terms of the sequence of things, I think we would want to implement #718 first, if you decide to do it. It's still sitting as an "idea" here although I have a vague memory you said something about going ahead with it somewhere else.
Yes, I think we must have had that conversation elsewhere. Please do go ahead with it, if you're still willing! 😀
I'll try to work on it over the weekend. Considering that I'm not employed and sheltering in place at home, it's amazing how many things I have going on. :smile: