Esempio n. 1
0
        public void LogMessage(string message)
        {
            if (!LogMessages)
            {
                return;
            }

            LogMessage(MessageContainer.CreateInfoMessage(message));
        }
Esempio n. 2
0
        public override AssemblyDefinition Resolve(AssemblyNameReference name, ReaderParameters parameters)
        {
            // Validate arguments, similarly to how the base class does it.
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (parameters == null)
            {
                throw new ArgumentNullException("parameters");
            }

            if (!_assemblies.TryGetValue(name.Name, out AssemblyDefinition asm) && (_unresolvedAssemblies == null || !_unresolvedAssemblies.Contains(name.Name)))
            {
                try {
                    // Any full path explicit reference takes precedence over other look up logic
                    asm = ResolveFromReferences(name, _references, parameters);

                    // Fall back to the base class resolution logic
                    if (asm == null)
                    {
                        asm = base.Resolve(name, parameters);
                    }

                    _assemblies[name.Name] = asm;
                } catch (AssemblyResolutionException) {
                    if (!_ignoreUnresolved)
                    {
                        throw;
                    }
                    _context.LogMessage(MessageContainer.CreateInfoMessage($"Ignoring unresolved assembly '{name.Name}'."));
                    if (_unresolvedAssemblies == null)
                    {
                        _unresolvedAssemblies = new HashSet <string> ();
                    }
                    _unresolvedAssemblies.Add(name.Name);
                }
            }

            return(asm);
        }
Esempio n. 3
0
        public void AddLocalSuppression(CustomAttribute ca, ICustomAttributeProvider provider)
        {
            SuppressMessageInfo info;

            if (!TryDecodeSuppressMessageAttributeData(ca, out info))
            {
                return;
            }

            if (!_localSuppressions.TryGetValue(provider, out var suppressions))
            {
                suppressions = new Dictionary <int, SuppressMessageInfo> ();
                _localSuppressions.Add(provider, suppressions);
            }

            if (suppressions.ContainsKey(info.Id))
            {
                _context.LogMessage(MessageContainer.CreateInfoMessage(
                                        $"Element {provider} has more than one unconditional suppression. Note that only the last one is used."));
            }

            suppressions[info.Id] = info;
        }