CnCNet / xna-cncnet-client

XNA / MonoGame based client for playing classic Command & Conquer games both online and offline with a CnCNet game spawner.
Other
223 stars 86 forks source link

Make sure StreamWriter is disposed in time #510

Closed SadPencil closed 4 months ago

SadPencil commented 4 months ago

Commit 6426387f1c49b8c7a777974f317aa5dacaee5984 changes the use of StreamWriter by using using var writer = new StreamWriter();, delaying the disposing work that triggers Flush() to the time when the whole function is ended, i.e., when game is already launched. This increase a chance where the spawner fails to read the configuration file written by the client (although rare).

This PR uses using (var writer = new StreamWriter()) to replace using var writer = new StreamWriter();

github-actions[bot] commented 4 months ago

Nightly build for this pull request: