An exception occurs when a client issues a request with a page size of Int.MaxValue

Found in

EPiServer.Social.Framework 1.5.2

Fixed in

EPiServer.Social.Framework 1.5.3

Created

Jan 10, 2018

Updated

Jul 06, 2018

State

Closed, Fixed and tested


Description

An exception occurs when a client requests a page of results (any feature) with a size of int.MaxValue.

On the client this exception appears as:

EPiServer.Social.Common.SocialException: An error occurred while processing the request
   at EPiServer.Social.Common.Rest.ResponseMessageHandler.<UnexpectedError>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at EPiServer.Social.Common.Rest.ResponseMessageHandler.<HandleUnsuccessful>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at EPiServer.Social.Comments.Rest.CommentResponseMessageHandler.<HandleUnsuccessful>d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at EPiServer.Social.Comments.Rest.CommentResponseMessageHandler.<HandleGetByCriteria>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at EPiServer.Social.Comments.Rest.HttpCommentRepository.<GetAsync>d__22.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at EPiServer.Social.Comments.CommentService.Get(Criteria`1 criteria)
   at UseaConnectivity.Program.Main(String[] args) in C:\Users\chba\documents\visual studio 2015\Projects\UseaConnectivity\UseaConnectivity\Program.cs:line 31

Steps to reproduce

1. Create an application that requests Social content (for example, comments) with a page size of int.MaxValue. (Sample code below)

            try
            {
                var criteria = new Criteria<CommentFilter>
                {
                    PageInfo = new PageInfo { PageSize = int.MaxValue }
                };
 
                var pageOfComments = commentService.Get(criteria);
 
                Console.WriteLine(pageOfComments.Results.Count());
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex);
            }

2. Notice the exception that occurs.

Workaround

  • As a workaround, a page size of int.MaxValue - 1 can be requested instead.

Fix

The fix for this issue is a server side change. No client update is necessary.