예제 #1
0
        public void ScanAndProcessReturnValue(MethodBody methodBody)
        {
            Scan(methodBody);

            if (!methodBody.Method.ReturnsVoid())
            {
                var method            = methodBody.Method;
                var methodReturnValue = _annotations.GetMethodReturnValue(method);
                if (methodReturnValue.DynamicallyAccessedMemberTypes != 0)
                {
                    var diagnosticContext = new DiagnosticContext(_origin, ShouldEnableReflectionPatternReporting(_origin.Provider), _context);
                    RequireDynamicallyAccessedMembers(diagnosticContext, ReturnValue, methodReturnValue);
                }
            }
        }
        protected override void Scan(MethodBody methodBody, ref InterproceduralState interproceduralState)
        {
            _origin = new MessageOrigin(methodBody.Method);
            base.Scan(methodBody, ref interproceduralState);

            if (!methodBody.Method.ReturnsVoid())
            {
                var method            = methodBody.Method;
                var methodReturnValue = _annotations.GetMethodReturnValue(method);
                if (methodReturnValue.DynamicallyAccessedMemberTypes != 0)
                {
                    HandleAssignmentPattern(_origin, ReturnValue, methodReturnValue);
                }
            }
        }