ErrorProne.NET icon indicating copy to clipboard operation
ErrorProne.NET copied to clipboard

Warn if a method is calling itself with same arguments (infinite recursion)

Open KirillOsenkov opened this issue 7 years ago • 2 comments

KirillOsenkov avatar Feb 27 '19 04:02 KirillOsenkov

Arhh... Got the same issue myself with infinite recursion! Will definitely create a rule to catch this!

SergeyTeplyakov avatar Mar 12 '19 21:03 SergeyTeplyakov

The test case:

protected async Task<TResult> PerformOperationAsync<TResult, TResponse>(
            OperationContext context,
            Func<SessionContext, AsyncUnaryCall<TResponse>> func,
            Func<TResponse, TResult> responseHandler)
            where TResult : ResultBase
            where TResponse : IGrpcResponse
        {
            var sessionContext = await CreateSessionContextAsync(context, context.Token);
            if (!sessionContext)
            {
                return new ErrorResult(sessionContext).AsResult<TResult>();
            }

            return await PerformOperationAsync(context, func, responseHandler);
        }

SergeyTeplyakov avatar Mar 12 '19 21:03 SergeyTeplyakov