[Debug] Entity Framework parameter exceed max length

Our team member report an error is that a user execute with large text from clipboard then occurred "String or binary data would be truncated"

Root cause

The reason is the length of the input value is 8000.I am curious about when executed "ToList" may not error but executed "Count" will occur error. Therefore, I traced the sql over SQL Profiler then figure out as below.
  • ToList() declared varchar(8000) -->exceed max length would be truncated by automatic
  • Count() declared  varchar(max) -->exceed max length throws an exception.

Popular posts from this blog

VS2017-Build fail-FindDependenciesOfExternallyResolvedReferences

SQL Server pass parameter to Procedure

IIS Block IP Setting