-
-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updates to support writing to new Notepad on Windows 11 #60
base: master
Are you sure you want to change the base?
Updates to support writing to new Notepad on Windows 11 #60
Conversation
* Adding needed interop definitions to enumerate child windows * If first attempt using FindWindowEx with notepad process MainWindowHandle does not find editor handle, the search is done by enumerating child window handles for the notepad process MainWindowHandle.
… not receive log messages.
… does not change by sending text to it, it is cleared in order to reget it.
@augustoproiete, I pushed another commit to the pull request |
@augustoproiete, any chance of looking at the PR? I need a new package with the fixes for a issue fix in my own project using this package. |
@augustoproiete, any news on completing the PR? |
Hi @bstordrup thanks for the ping. I'll get this one merged & released over the weekend |
* Adding needed interop definitions to enumerate child windows * If first attempt using FindWindowEx with notepad process MainWindowHandle does not find editor handle, the search is done by enumerating child window handles for the notepad process MainWindowHandle.
… not receive log messages.
… does not change by sending text to it, it is cleared in order to reget it.
https://github.com/bstordrup/serilog-sinks-notepad into Issue59_FindEditorHandleThroughChildWindowEnumeration
* Adding needed interop definitions to enumerate child windows * If first attempt using FindWindowEx with notepad process MainWindowHandle does not find editor handle, the search is done by enumerating child window handles for the notepad process MainWindowHandle.
7fdcf57
to
7ab2698
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot @bstordrup and apologies for the delay. I haven't been using Windows for some time now, and took me sometime to get both a Windows 10 and Windows 11 VMs ready to debug/run this sink.
Overall looks great, and everything works as expect on both Windows 10 and Windows 11 as per my tests.
I only have one concern about a possible memory leak in case the buffer is not cleared. I'm pushing a retry policy to address that. Let me know what you think.
src/Serilog.Sinks.Notepad/Sinks/Notepad/Interop/NotepadTextWriter.cs
Outdated
Show resolved
Hide resolved
Did you verify if there is a memory leak? The buffer is retrieved and
cleared in the Flush method, so it should be disposed after the method
ends. But it might depend on how the GetStringBuilder method creates it. I
will have a look.
If you don't mind, I will try to rewrite the retry logic. I am not very
fond of the goto statement 😁
søn. 4. jun. 2023 08.41 skrev C. Augusto Proiete ***@***.***>:
… ***@***.**** commented on this pull request.
Thanks a lot @bstordrup <https://github.com/bstordrup> and apologies for
the delay. I haven't been using Windows for some time now, and took me
sometime to get both a Windows 10 and Windows 11 VMs ready to debug/run
this sink.
Overall looks great, and everything works as expect on both Windows 10 and
Windows 11 as per my tests.
I only have one concern about a possible memory leak in case the buffer is
not cleared. I'm pushing a retry policy to address that. Let me know what
you think.
------------------------------
In src/Serilog.Sinks.Notepad/Sinks/Notepad/Interop/NotepadTextWriter.cs
<#60 (comment)>
:
> + // Otherwise, we clear the buffer
+
+ buffer.Clear();
It seems that if we keep failing to write to the Notepad, the buffer would
keep growing forever 🤔. I think we need to add a retry policy here (say,
try 3 times, and give up)
—
Reply to this email directly, view it on GitHub
<#60 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKMB2RMMUIOD5D32LOECUVTXJQUZBANCNFSM6AAAAAAYBLNPEQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***
com>
|
…g base.GetStringBuilder - which just returns the StringBuilder _sb from the base TextWriter class. And this one may or may not have created the StringBuilder instance - depending on which constructor has been called. But it does not destroy it.
src/Serilog.Sinks.Notepad/Sinks/Notepad/Interop/NotepadTextWriter.cs
Outdated
Show resolved
Hide resolved
Hello @augustoproiete, |
Hello @augustoproiete, |
Thanks for the ping gents. Definitely keen to get this in, and have been short on time for OSS. Will try to get some time on one of the upcoming weekends this month |
@augustoproiete any update on when this will be completed? |
Closing #59