Microsoft.SourceBrowser.BuildLogParser.LogAnalyzer.SanityCheckAfterMetadataAsSource C# (CSharp) Method

SanityCheckAfterMetadataAsSource() public static method

public static SanityCheckAfterMetadataAsSource ( IEnumerable invocations, Options options = null ) : void
invocations IEnumerable
options Options
return void
        public static void SanityCheckAfterMetadataAsSource(IEnumerable<CompilerInvocation> invocations, Options options = null)
        {
            var allInvocationAssemblyNames = new HashSet<string>(
                invocations.Select(i => i.AssemblyName),
                StringComparer.OrdinalIgnoreCase);
            var allReferenceAssemblyNames = new HashSet<string>(
                invocations
                .SelectMany(i => i.ReferencedBinaries)
                .Select(b => Path.GetFileNameWithoutExtension(b)), StringComparer.OrdinalIgnoreCase);
            allReferenceAssemblyNames.ExceptWith(allInvocationAssemblyNames);

            //var invocationsWithUnindexedReferences = analyzer.Invocations
            //    .Where(i => i.ReferencedBinaries.Any(b => !allInvocationAssemblyNames.Contains(Path.GetFileNameWithoutExtension(b))))
            //    .Select(i => Tuple.Create(i, i.ReferencedBinaries.Where(b => !allInvocationAssemblyNames.Contains(Path.GetFileNameWithoutExtension(b))).ToArray()))
            //    .ToArray();
            //if (invocationsWithUnindexedReferences.Length > 0)
            //{
            //    throw new InvalidOperationException("Invocation with unindexed references: " + invocationsWithUnindexedReferences.First().Item1.ProjectFilePath);
            //}

            if (options == null || options.CheckForMissingOutputBinary)
            {
                var invocationsWhereBinaryDoesntExist = invocations.Where(
                    i => !File.Exists(i.OutputAssemblyPath)).ToArray();
                if (invocationsWhereBinaryDoesntExist.Length > 0)
                {
                    throw new InvalidOperationException("Invocation where output binary doesn't exist: " + invocationsWhereBinaryDoesntExist.First().OutputAssemblyPath);
                }
            }
        }