Exercise 2: Why COM Cleanup Belongs in finally — Possible Solution ==================================================================== WHY finally IS USED ------------------------------ Per Fundamentals 9, finally runs regardless of whether the try block succeeded or an error occurred partway through it - it's the guaranteed cleanup block. Placing .Quit() and ReleaseComObject() inside finally, rather than just after the try block, ensures the Excel process is always properly closed and released, whether the workbook was written successfully or something failed midway through (a bad cell reference, a permissions issue on SaveAs, or any other error). WHAT COULD HAPPEN WITHOUT finally ------------------------------ Per Chapter 5's own COM cleanup gotcha, a COM object doesn't get the same automatic garbage collection a normal .NET object does - the underlying EXCEL.EXE process only stops when explicitly told to via .Quit(). If the cleanup calls sat directly after the try block instead of inside finally, and something inside the try block threw an error before reaching SaveAs() (or before reaching the cleanup lines themselves), execution would jump straight past those cleanup lines entirely - leaving EXCEL.EXE running as an orphaned background process, exactly the scenario Chapter 5 warned about, and precisely the situation this capstone's own error-prone report-writing step (touching many cells, a real file path) is genuinely likely to hit at some point. WHY THIS WORKS AS AN ANSWER ------------------------------ It correctly explains that finally guarantees the cleanup code runs regardless of success or failure, and correctly connects the consequence of omitting it back to Chapter 5's own specific COM-cleanup gotcha - an orphaned EXCEL.EXE process left running.