Exemplo n.º 1
0
        public void BadPdb_ForwardChain()
        {
            const int    methodVersion = 1;
            const int    methodToken1  = 0x600057a; // Forwards to 2
            const int    methodToken2  = 0x600055d; // Forwards to 3
            const int    methodToken3  = 0x6000540; // Has a using
            const string importString  = "USystem";

            ISymUnmanagedReader reader = new MockSymUnmanagedReader(new Dictionary <int, MethodDebugInfoBytes>
            {
                { methodToken1, new MethodDebugInfoBytes.Builder().AddForward(methodToken2).Build() },
                { methodToken2, new MethodDebugInfoBytes.Builder().AddForward(methodToken3).Build() },
                { methodToken3, new MethodDebugInfoBytes.Builder(new [] { new [] { importString } }).Build() },
            }.ToImmutableDictionary());

            ImmutableArray <string> externAliasStrings;
            var importStrings = reader.GetCSharpGroupedImportStrings(methodToken1, methodVersion, out externAliasStrings);

            Assert.True(importStrings.IsDefault);
            Assert.True(externAliasStrings.IsDefault);

            importStrings = reader.GetCSharpGroupedImportStrings(methodToken2, methodVersion, out externAliasStrings);
            Assert.Equal(importString, importStrings.Single().Single());
            Assert.Equal(0, externAliasStrings.Length);

            importStrings = reader.GetCSharpGroupedImportStrings(methodToken2, methodVersion, out externAliasStrings);
            Assert.Equal(importString, importStrings.Single().Single());
            Assert.Equal(0, externAliasStrings.Length);
        }
Exemplo n.º 2
0
        public void BadPdb_Cycle()
        {
            const int methodVersion = 1;
            const int methodToken1  = 0x600057a; // Forwards to itself

            ISymUnmanagedReader reader = new MockSymUnmanagedReader(new Dictionary <int, MethodDebugInfoBytes>
            {
                { methodToken1, new MethodDebugInfoBytes.Builder().AddForward(methodToken1).Build() },
            }.ToImmutableDictionary());

            ImmutableArray <string> externAliasStrings;
            var importStrings = reader.GetCSharpGroupedImportStrings(methodToken1, methodVersion, out externAliasStrings);

            Assert.True(importStrings.IsDefault);
            Assert.True(externAliasStrings.IsDefault);
        }
Exemplo n.º 3
0
        public void BadPdb_Cycle()
        {
            const int methodVersion = 1;
            const int methodToken1 = 0x600057a; // Forwards to itself

            ISymUnmanagedReader reader = new MockSymUnmanagedReader(new Dictionary<int, MethodDebugInfoBytes>
            {
                { methodToken1, new MethodDebugInfoBytes.Builder().AddForward(methodToken1).Build() },
            }.ToImmutableDictionary());

            ImmutableArray<string> externAliasStrings;
            var importStrings = reader.GetCSharpGroupedImportStrings(methodToken1, methodVersion, out externAliasStrings);
            Assert.True(importStrings.IsDefault);
            Assert.True(externAliasStrings.IsDefault);
        }
Exemplo n.º 4
0
        public void BadPdb_ForwardChain()
        {
            const int methodVersion = 1;
            const int methodToken1 = 0x600057a; // Forwards to 2
            const int methodToken2 = 0x600055d; // Forwards to 3
            const int methodToken3 = 0x6000540; // Has a using
            const string importString = "USystem";

            ISymUnmanagedReader reader = new MockSymUnmanagedReader(new Dictionary<int, MethodDebugInfoBytes>
            {
                { methodToken1, new MethodDebugInfoBytes.Builder().AddForward(methodToken2).Build() },
                { methodToken2, new MethodDebugInfoBytes.Builder().AddForward(methodToken3).Build() },
                { methodToken3, new MethodDebugInfoBytes.Builder(new [] { new [] { importString } }).Build() },
            }.ToImmutableDictionary());

            ImmutableArray<string> externAliasStrings;
            var importStrings = reader.GetCSharpGroupedImportStrings(methodToken1, methodVersion, out externAliasStrings);
            Assert.True(importStrings.IsDefault);
            Assert.True(externAliasStrings.IsDefault);

            importStrings = reader.GetCSharpGroupedImportStrings(methodToken2, methodVersion, out externAliasStrings);
            Assert.Equal(importString, importStrings.Single().Single());
            Assert.Equal(0, externAliasStrings.Length);

            importStrings = reader.GetCSharpGroupedImportStrings(methodToken2, methodVersion, out externAliasStrings);
            Assert.Equal(importString, importStrings.Single().Single());
            Assert.Equal(0, externAliasStrings.Length);
        }