Esempio n. 1
0
            internal string VisualizeIL(CompilationTestData.MethodData methodData, bool realIL, string sequencePoints = null)
            {
                Dictionary <int, string> markers = null;

                if (sequencePoints != null)
                {
                    var actualPdbXml = PdbToXmlConverter.ToXml(
                        pdbStream: new MemoryStream(EmittedAssemblyPdb.ToArray()),
                        peStream: new MemoryStream(EmittedAssemblyData.ToArray()),
                        options: PdbToXmlOptions.ResolveTokens |
                        PdbToXmlOptions.ThrowOnError |
                        PdbToXmlOptions.ExcludeDocuments |
                        PdbToXmlOptions.ExcludeCustomDebugInformation |
                        PdbToXmlOptions.ExcludeScopes,
                        methodName: sequencePoints);

                    markers = PdbValidation.GetMarkers(actualPdbXml);
                }

                if (!realIL)
                {
                    return(ILBuilderVisualizer.ILBuilderToString(methodData.ILBuilder, markers: markers));
                }

                if (_lazyModuleSymbol == null)
                {
                    _lazyModuleSymbol = GetModuleSymbolForEmittedImage(EmittedAssemblyData, MetadataImportOptions.All);
                }

                return(_lazyModuleSymbol != null?_test.VisualizeRealIL(_lazyModuleSymbol, methodData, markers) : null);
            }
            private string VisualizeIL(CompilationTestData.MethodData methodData, bool realIL, bool useRefEmitter)
            {
                if (!realIL)
                {
                    return(ILBuilderVisualizer.ILBuilderToString(methodData.ILBuilder));
                }

                var module = this.GetModuleSymbolForEmittedImage();

                return(module != null?test.VisualizeRealIL(module, methodData) : null);
            }
            private string VisualizeIL(CompilationTestData.MethodData methodData, bool realIL, string sequencePoints, bool useRefEmitter)
            {
                Dictionary <int, string> markers = null;

                if (sequencePoints != null)
                {
                    var actualPdbXml = PdbToXmlConverter.ToXml(
                        pdbStream: new MemoryStream(EmittedAssemblyPdb.ToArray()),
                        peStream: new MemoryStream(EmittedAssemblyData.ToArray()),
                        options: PdbToXmlOptions.ResolveTokens | PdbToXmlOptions.ThrowOnError,
                        methodName: sequencePoints);

                    markers = GetMarkers(actualPdbXml);
                }

                if (!realIL)
                {
                    return(ILBuilderVisualizer.ILBuilderToString(methodData.ILBuilder, markers: markers));
                }

                var module = this.GetModuleSymbolForEmittedImage();

                return(module != null?_test.VisualizeRealIL(module, methodData, markers) : null);
            }