MicroTrendsLtd / NinjaTrader8

NinjaTrader8 Components Strategies and Trading tools
MIT License
73 stars 19 forks source link

Bug - Logging exception #26

Closed MicroTrendsTom closed 3 years ago

MicroTrendsTom commented 3 years ago

An exception occurred writing trace output to log file 'D:\Users\Trader\Documents\NinjaTrader 8\trace\ATS.NT8.20201208.Trace.txt'. System.IO.IOException: The process cannot access the file 'D:\Users\Trader\Documents\NinjaTrader 8\trace\ATS.NT8.20201208.Trace.txt' because it is being used by another process. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) at System.IO.FileInfo.Open(FileMode mode) at System.Diagnostics.DefaultTraceListener.WriteToLogFile(String message, Boolean useWriteLine)

found in VS2019 debug session output

MicroTrendsTom commented 3 years ago

added lock (logLockObject) in public static void WriteLine(string message)

MicroTrendsTom commented 3 years ago

seems to be fixed ok in that commit