-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Update the maximum message length in the EventLog.WriteEntry method documentation #9999
base: main
Are you sure you want to change the base?
Conversation
It was found empirically on Windows 10 that the maximum message length is 31,718.
Tagging subscribers to this area: @tommcdon |
Learn Build status updates of commit a78d259: ✅ Validation status: passed
For more details, please refer to the build report. For any questions, please:
|
@tommcdon Could you review? |
.NET is using https://learn.microsoft.com/windows/win32/api/winbase/nf-winbase-reporteventw
The .NET code that calls // make sure the strings aren't too long. MSDN says each string has a limit of 32k (32768) characters, but
// experimentation shows that it doesn't like anything larger than 32766
if (strings[i].Length > 32766)
throw new ArgumentException(SR.LogEntryTooLong); Therefore, the error would likely be coming from Windows and not .NET for string lengths <= 32766 characters. Given that .NET has no control over the version of Windows and the various character limits it is imposing, I suggest we remove mentions of specific character limits under 32766 characters. Also I would expect that if the string length is <= 32766 and the API call fails due to a restriction from Windows, we would get a Win32Exception and not an ArgumentException. @0xced can you confirm? If yes, then I suggest changing the text to something like: |
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.
I left a comment for your review
Summary
It was found empirically on Windows 10 that the maximum message length is 31,718.