The thread ‘’ (0x3) has exited with code 0 (0x0).
A first chance exception of type ‘System.IO.IOException’ occurred in Microsoft.SPOT.IO.dll
A first chance exception of type ‘System.IO.IOException’ occurred in System.IO.dll
Message: Exception was thrown: System.IO.IOException Inner Exception:
The guys have pinpointed your issue but I wanted to give another suggestion to help your diagnosing this kind of issue in the future.
A simple debug step in a case like this where you fail on a known particular line is to break apart the compound instruction. Create a string that is the ToString output, and inspect it. Also use a fixed string of some other form. You would have seen the character in what becomes the output filename and seen that your code works when using a simpler name, and you could have come to the conclusion that the name was wrong.
I also subscribe to the additive approach - the “fundamental” problems in this area of code are writing to a file and taking the picture. Ensure you know how to achieve both independently, then bring them together. That way you know that as each new issue comes up you can step back to the fundamentals that you have already addressed and in this case you should be able to pick up how your code change for the filename was what generated the fault