Exemplo n.º 1
0
            private IModuleSymbol GetModuleSymbolForEmittedImage(ImmutableArray <byte> peImage, MetadataImportOptions importOptions)
            {
                if (peImage.IsDefault)
                {
                    return(null);
                }

                var targetReference = LoadTestEmittedExecutableForSymbolValidation(peImage, _compilation.Options.OutputKind, display: _compilation.AssemblyName);
                var references      = _compilation.References.Concat(new[] { targetReference });
                var assemblies      = _test.ReferencesToModuleSymbols(references, importOptions);

                return(assemblies.Last());
            }
            private IModuleSymbol GetModuleSymbolForEmittedImage(ref IModuleSymbol moduleSymbol, ImmutableArray <byte> peImage)
            {
                if (peImage.IsDefault)
                {
                    return(null);
                }

                if (moduleSymbol == null)
                {
                    Debug.Assert(!peImage.IsDefault);

                    var targetReference = LoadTestEmittedExecutableForSymbolValidation(peImage, _compilation.Options.OutputKind, display: _compilation.AssemblyName);
                    var references      = _compilation.References.Concat(new[] { targetReference });
                    var assemblies      = _test.ReferencesToModuleSymbols(references, _compilation.Options.MetadataImportOptions);
                    var module          = assemblies.Last();
                    moduleSymbol = module;
                }

                return(moduleSymbol);
            }