コード例 #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);
                }
            }
        }
コード例 #2
0
        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);
                }
            }
        }