❔ File.WriteAllText(string, string?) and similar fail to write to file
Hi, im working on a Logger library and im trying different ways to implement logging to a file, but no matter what i tried (File.WriteAllText, File.WriteAllTextAsync, File.Append, FileStream.Write) they all end creating a file, but not writing to it
the function for writing text to a file is as follow
LogFile
and File_WriteText
are both members of the OLog
class, LogFile
is a public string containing a path to the log file, by default it is log
,
if i missed any information do ask for more, the end result will most likely be open source anyways
OS:: Arch Linux
.NET:: 7.0/6.0 (both have the same issue)18 Replies
You're probably looking in the wrong place for the file. There's very little that can go wrong with WriteAllText
eventually you can use sysinternal's tool to look where your program is writing
but seems overkill for this
i can see the file get created it just does not have any content
Run the debugger to ensure the string you're trying to write actually contains something?
yeah it contains something
is there an exception being annihilated?
how would i check?
what tool is that?
filemon, which has been replaced by process monitor
good to know this exists thanks
only on windows tho'
yeah ik
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.damnit shit's not solved
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.ffs it's not solved
how writing a file on a local drive can take so much to debug
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.