Update the maximum message length in the EventLog.WriteEntry method documentation#9999
Update the maximum message length in the EventLog.WriteEntry method documentation#99990xced wants to merge 1 commit intodotnet:mainfrom
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: |
tommcdon
left a comment
There was a problem hiding this comment.
I left a comment for your review
|
@0xced Do you plan to address the requested changes? |
Summary
It was found empirically on Windows 10 that the maximum message length is 31,718.