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
System.Diagnostics.TextWriterTraceListener: System.ArgumentOutOfRangeException: Count cannot be less than zero. Parameter name: count #101600
Comments
Tagging subscribers to this area: @tarekgh, @tommcdon, @pjanotti |
This is seems Sysstem.IO issue. Here is a readable stack:
The string that trying to write to the stream is originally created by a call like |
Tagging subscribers to this area: @dotnet/area-system-io |
The original poster cited running on .NET Framework 4.8. |
@stephentoub good point. on netfx, the string is created normally using The code will throw in the line https://referencesource.microsoft.com/#mscorlib/system/io/streamwriter.cs,437 which has assert statement in the previous line suggesting what the problem could be: |
We have a app hosted in AWS and we get this exception in our database once a while bringing the application down. A simple restart of the services makes it work again. This issue has been flagged in Github at multiple places but there is no resolution or root cause for this . Can someone please help here.
.NET framework - 4.8
Stack trace is below:
Exception
ArgumentOutOfRangeException
StackTrace
at System.String.CopyTo(Int32 sourceIndex, Char[] destination, Int32 destinationIndex, Int32 count) at System.IO.StreamWriter.Write(String value) at System.IO.TextWriter.SyncTextWriter.Write(String value) at System.Diagnostics.TextWriterTraceListener.Write(String message) at System.Diagnostics.TraceListener.WriteHeader(String source, TraceEventType eventType, Int32 id) at System.Diagnostics.TraceListener.TraceEvent(TraceEventCache eventCache, String source, TraceEventType eventType, Int32 id, String message) at System.Diagnostics.TraceInternal.TraceEvent(TraceEventType eventType, Int32 id, String format, Object[] args) at System.Web.Http.Tracing.SystemDiagnosticsTraceWriter.TraceMessage(TraceLevel level, String message) at System.Web.Http.Tracing.SystemDiagnosticsTraceWriter.Trace(HttpRequestMessage request, String category, TraceLevel level, Action
1 traceAction) at System.Web.Http.Tracing.ITraceWriterExtensions.TraceError(ITraceWriter traceWriter, Exception exception, HttpRequestMessage request, String category, String operatorName, String operationName, Action
1 errorTrace) at System.Web.Http.Tracing.ITraceWriterExtensions.d__24.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Owin.HttpMessageHandlerAdapter.d__13.MoveNext()The text was updated successfully, but these errors were encountered: