Installed the Code::Stats Plugin for Notepad++ a few hours ago, and run into a pretty serious issue; the kind of issue that will make me uninstall CodeStats ASAP.
What is the bug about:
As soon as I start typing in files which have an extension that is not registered I am getting error.
The bugfix should :
- either allow registering other file extension,
- or prevent the errors from popping up.
---------------------------
Error writing to log file
---------------------------
System.IO.IOException: The process cannot access the file 'C:\Users\Pino\AppData\Roaming\Notepad++\plugins\Config\CodeStats.log' 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 CodeStats.Logger.Setup()
at CodeStats.Logger.Log(LogLevel level, String msg)
---------------------------
OK
---------------------------
Followed by:
---------------------------
Error writing to log file
---------------------------
C:\Users\Pino\AppData\Roaming\Notepad++\plugins\Config\Code::Stats.log
---------------------------
OK
---------------------------
Typical files which trigger the error are ".cmd" and ".au3".
Despite the fact the error says the log file could not be written, we can still see some output in there. (And the output seem up-to-date.)
[Code::Stats Debug 06:28:12 PM] SCN_CHARADDED - File: U:\Dropbox\Sandbox\CodeStat-Assist.au3, char: 97, lang: AutoIt
[Code::Stats Info 06:28:12 PM] Key = "au3" is not found.
[Code::Stats Info 06:28:12 PM] Key = "au3" is not found.
[Code::Stats Debug 06:28:12 PM] SCN_CHARADDED - File: U:\Dropbox\Sandbox\CodeStat-Assist.au3, char: 115, lang: AutoIt
[Code::Stats Info 06:28:12 PM] Key = "au3" is not found.
[Code::Stats Info 06:28:12 PM] Key = "au3" is not found.
[Code::Stats Debug 06:28:12 PM] SCN_CHARADDED - File: U:\Dropbox\Sandbox\CodeStat-Assist.au3, char: 97, lang: AutoIt
[Code::Stats Info 06:28:12 PM] Key = "au3" is not found.
[Code::Stats Info 06:28:12 PM] Key = "au3" is not found.
[Code::Stats Debug 06:28:12 PM] SCN_CHARADDED - File: U:\Dropbox\Sandbox\CodeStat-Assist.au3, char: 115, lang: AutoIt
[Code::Stats Debug 06:28:28 PM] No proxy will be used. It's either not set or badly formatted.
[Code::Stats Debug 06:28:28 PM] Pulsing {"xps":[{"language":"AutoIt","xp":16}],"coded_at":"2019-04-25T18:28:12+02:00"}
Or when editing a "*.cmd" command file
What those ".cmd" and ".au3" files seem to have in common is that they are not registered in the Plugin DLL, which, if you open it, contains the following static string :
(C:\Program Files\Notepad++\plugins\CodeStats\CodeStats.dll)
"plaintext": "Plain text",
"txt": "Plain text",
"log": "Log",
"bat": "Batch",
"clojure": "Clojure",
"coffeescript": "CoffeeScript",
"coffee": "CoffeeScript",
"c": "C",
"cpp": "C++",
"hpp": "C++",
"csharp": "C#",
"cs": "C#",
"css": "CSS",
"diff": "Diff",
"dockerfile": "Docker",
"elixir": "Elixir",
"elm": "Elm",
"fsharpcss": "F#",
"git": "Git",
"gitignore": "Ignore File (gitignore syntax)",
"git-commit": "Git",
"git-rebase": "Git",
"go": "Go",
"groovy": "Groovy",
"handlebars": "Handlebars",
"hlsl": "HLSL",
"html": "HTML",
"i18n": "Localization file",
"ini": "Ini",
"properties": "Properties",
"conf": "Properties",
"cfg": "Properties",
"java": "Java",
"javascriptreact": "JavaScript (React)",
"javascript": "JavaScript",
"js": "JavaScript",
"jsx-tags": "JavaScript (JSX)",
"json": "JSON",
"less": "LESS",
"lua": "Lua",
"makefile": "Makefile",
"markdown": "Markdown",
"md": "Markdown",
"nut": "Squirrel",
"objective-c": "Objective-C",
"perl": "Perl",
"perl6": "Perl 6",
"php": "PHP",
"powershell": "PowerShell",
"jade": "Pug",
"python": "Python",
"py": "python",
"r": "R",
"razor": "Razor",
"raml": "RAML",
"ruby": "Ruby",
"rust": "Rust",
"scss": "SCSS",
"shaderlab": "Shaderlab",
"shellscript": "Shell Script",
"sql": "SQL",
"swift": "Swift",
"typescript": "TypeScript",
"typescriptreact": "TypeScript (React)",
"vb": "Visual Basic",
"xml": "XML",
"xsl": "XSL",
"yaml": "YAML"
I don't think the log file is used by another process. The only thing that is specific with my setup is that my directory "%AppData%\Roaming\Notepad++\plugins\Config
" is actually a hardlink to another location (a Dropbox directory), and for some reason this is maybe making harder for the plugin to write in it, which then causes the exception and finally makes Notepad++ display error message dialogs as I type.
Also, note that I don't have this problem if I write in more common files, such as a .txt or a .cs, so it's a cascading effect, ie. there are 2 problems here : 1/ log file being filled with the "Key = "EXT" is not found.
" and 2/ actually sometimes failing to write there and causing the errors to pop and interrupt editing ever couple of keystrokes.