public void SomeFunctionDelegateWithEndInvokeWithNullArgument()
        {
            var @delegate = DelegatesSample.GetSomeFunctionDelegate();

            Action act = () => @delegate.EndInvoke(null /*Expect:AssignNullToNotNullAttribute[MIn]*/);

            act.Should().Throw <RemotingException>("because the IAsyncResult argument is null");
        }
        public void SomeFunctionDelegate()
        {
            Action act = () =>
            {
                DelegatesSample.SomeFunctionDelegate @delegate = DelegatesSample.GetSomeFunctionDelegate();
                var result = @delegate();
                // This false negative is analog to SomeFunctionDelegateWithNotNull and even requires an exemption for the delegate Invoke() method,
                // but it is necessary because the developer can't opt out of the implicit annotation with [CanBeNull]:
                TestValueAnalysis(result, result == null);
            };

            act.Should().NotThrow(BecauseDelegateMethodIsAnonymous);
        }
        public void SomeFunctionDelegateWithInvokeAndBeginInvokeCalls()
        {
            Action act = () =>
            {
                var @delegate = DelegatesSample.GetSomeFunctionDelegate();
                var result    = @delegate.Invoke();
                TestValueAnalysis(result, result == null /* REPORTED false negative https://youtrack.jetbrains.com/issue/RSRP-446852 */);

                var asyncResult     = @delegate.BeginInvoke(null, null);
                var endInvokeResult = @delegate.EndInvoke(asyncResult);
                TestValueAnalysis(endInvokeResult, endInvokeResult == null);
            };

            act.Should().NotThrow(BecauseDelegateMethodIsAnonymous);
        }