Updating from visual studionet 2016 to
In theory, the “regular” output from a very involved NAnt script could cause the buffers to fill up.
It’s just a fluke that I hadn’t hit this up to this point.
Before 0.4, I would wait until the process finished and then get the entire contents of the buffer: When I started using the verbose switch, the NAnt process hung because the process generated much more output than before (imagine that, “verbose” equals “more”), and the output buffers filled up before the process finished.
On one of the forms of my side project, I grouped like controls into a series of custom user controls.In my production code, both the Imported and Rejected event use a custom class that descends from Event Args to pass back some additional information about the item that was just imported or just rejected, and it tests that returned data to make sure it was what I expected given the input.I’ve removed this from the above code snippets to avoid muddling the core point (testing for events).First, I started with a test: When my test runs and the Do Import method does its thing, I expect there to be one or more events raised.I have event handlers wired up listening for those events and they keep track of the number of times each event is raised.The invoking code was actually the user form, and it was responsible for updating record stats (“Records Imported Successfully: 120”) and logging the rejected records with a meaningful error message so the user can examine them after the fact.Up to this point, the unit tests for the Import class would pass in a set of delimited data rows, and then analyze the actual records imported or rejected.So, the solution (as this article describes) is to provide a Protected method in the base class that wraps Raise Event, which allows the derived classes to invoke the event indirectly.In particular, the methods needs to be “protected virtual void” in C#-ese, or “Protected Overridable Sub” in VB-ese: My derived classes can then call My Base. The main form, then, handles this base class event for each of the controls, allowing me to address each control differently if I needed to: In the new release of NAnt Runner, one of the new features is a checkbox to add the -verbose switch to the NAnt call.I started doing some searching for “process.start hung” and “process.start doesn’t exit”, and eventually came to a couple of articles that talked about the output buffers filling up: Both of these discuss redirecting the buffers for a spawned process.As it turns out, the buffers have a 2K limit and if they fill up, the process hangs. All versions of NAnt Runner have redirected the standard output and error buffers for the spawned process so I could display the contents of those buffers in the NAnt Runner interface.