question

WillPittenger avatar image
0 Votes"
WillPittenger asked WillPittenger answered

StreamWriter.StreamWriter(string) creates folder instead of text file

I have an older project that was working. It has a line of code that attempts to create a text file. It looks like this:

new System.IO.StreamWriter(Program.LogXML_FullPath)


Program.LogXML_FullPath returns a string and I've verified the value is as expected. The text file specified doesn't exist. So this constructor should create a text file as I've read the documentation. But it creates a folder with the expected name and appears to try to open that as a text file.

What's going on? As this project was considered stable, it hasn't changed much in ages and targets .NET Framework 4.

dotnet-csharpdotnet-runtimedotnet-standard
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

WillPittenger avatar image
0 Votes"
WillPittenger answered

Never mind. I stepped through the code once. It didn't create a folder then, but it did the next time that function was called. The new folder had the name of the folder. Sorry.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.