// Methods that do no return (i.e. throw) are not inlined // https://github.com/dotnet/coreclr/pull/6103 private static void ThrowInvalidArguments(string buffer, int offset, int length) { // Only have single throw in method so is marked as "does not return" and isn't inlined to caller throw GetInvalidArgumentsException(); Exception GetInvalidArgumentsException() { if (buffer == null) { return(ThrowHelper.GetArgumentNullException(ExceptionArgument.buffer)); } if (offset < 0) { return(ThrowHelper.GetArgumentOutOfRangeException(ExceptionArgument.offset)); } if (length < 0) { return(ThrowHelper.GetArgumentOutOfRangeException(ExceptionArgument.length)); } return(ThrowHelper.GetArgumentException(ExceptionResource.Argument_InvalidOffsetLength)); } }
private static Exception GetInvalidArgumentException(string buffer, int offset, int length) { if (buffer == null) { return(ThrowHelper.GetArgumentNullException(ExceptionArgument.buffer)); } if (offset < 0) { return(ThrowHelper.GetArgumentOutOfRangeException(ExceptionArgument.offset)); } if (length < 0) { return(ThrowHelper.GetArgumentOutOfRangeException(ExceptionArgument.length)); } return(ThrowHelper.GetArgumentException(ExceptionResource.Argument_InvalidOffsetLength)); }
private void ThrowInvalidArguments(int offset, int length, ExceptionArgument offsetOrStart) { throw GetInvalidArgumentsException(HasValue); Exception GetInvalidArgumentsException(bool hasValue) { if (!hasValue) { return(ThrowHelper.GetArgumentOutOfRangeException(offsetOrStart)); } if (offset < 0) { return(ThrowHelper.GetArgumentOutOfRangeException(offsetOrStart)); } if (length < 0) { return(ThrowHelper.GetArgumentOutOfRangeException(ExceptionArgument.length)); } return(ThrowHelper.GetArgumentException(ExceptionResource.Argument_InvalidOffsetLengthStringSegment)); } }