当前位置: 首页>>代码示例>>C#>>正文


C# MetadataBuilder.ValidateOrder方法代码示例

本文整理汇总了C#中MetadataBuilder.ValidateOrder方法的典型用法代码示例。如果您正苦于以下问题:C# MetadataBuilder.ValidateOrder方法的具体用法?C# MetadataBuilder.ValidateOrder怎么用?C# MetadataBuilder.ValidateOrder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MetadataBuilder的用法示例。


在下文中一共展示了MetadataBuilder.ValidateOrder方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ValidateStateMachineMethodTable

        public void ValidateStateMachineMethodTable()
        {
            var builder = new MetadataBuilder();
            builder.AddStateMachineMethod(MetadataTokens.MethodDefinitionHandle(2), default(MethodDefinitionHandle));
            builder.AddStateMachineMethod(MetadataTokens.MethodDefinitionHandle(1), default(MethodDefinitionHandle));
            Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder());

            builder = new MetadataBuilder();
            builder.AddStateMachineMethod(MetadataTokens.MethodDefinitionHandle(1), default(MethodDefinitionHandle));
            builder.AddStateMachineMethod(MetadataTokens.MethodDefinitionHandle(1), default(MethodDefinitionHandle));
            Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder());
        }
开发者ID:ESgarbi,项目名称:corefx,代码行数:12,代码来源:MetadataBuilderTests.cs

示例2: ValidateNestedClassTable

        public void ValidateNestedClassTable()
        {
            var builder = new MetadataBuilder();
            builder.AddNestedType(MetadataTokens.TypeDefinitionHandle(2), default(TypeDefinitionHandle));
            builder.AddNestedType(MetadataTokens.TypeDefinitionHandle(1), default(TypeDefinitionHandle));
            Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder());

            builder = new MetadataBuilder();
            builder.AddNestedType(MetadataTokens.TypeDefinitionHandle(1), default(TypeDefinitionHandle));
            builder.AddNestedType(MetadataTokens.TypeDefinitionHandle(1), default(TypeDefinitionHandle));
            Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder());
        }
开发者ID:ESgarbi,项目名称:corefx,代码行数:12,代码来源:MetadataBuilderTests.cs

示例3: ValidateLocalScopeTable

        public void ValidateLocalScopeTable()
        {
            var builder = new MetadataBuilder();
            builder.AddLocalScope(MetadataTokens.MethodDefinitionHandle(2), default(ImportScopeHandle), default(LocalVariableHandle), default(LocalConstantHandle), startOffset: 0, length: 1);
            builder.AddLocalScope(MetadataTokens.MethodDefinitionHandle(1), default(ImportScopeHandle), default(LocalVariableHandle), default(LocalConstantHandle), startOffset: 0, length: 1);
            Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder());

            builder = new MetadataBuilder();
            builder.AddLocalScope(MetadataTokens.MethodDefinitionHandle(1), default(ImportScopeHandle), default(LocalVariableHandle), default(LocalConstantHandle), startOffset: 1, length: 1);
            builder.AddLocalScope(MetadataTokens.MethodDefinitionHandle(1), default(ImportScopeHandle), default(LocalVariableHandle), default(LocalConstantHandle), startOffset: 0, length: 1);
            Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder());

            builder = new MetadataBuilder();
            builder.AddLocalScope(MetadataTokens.MethodDefinitionHandle(1), default(ImportScopeHandle), default(LocalVariableHandle), default(LocalConstantHandle), startOffset: 0, length: 1);
            builder.AddLocalScope(MetadataTokens.MethodDefinitionHandle(1), default(ImportScopeHandle), default(LocalVariableHandle), default(LocalConstantHandle), startOffset: 0, length: 2);
            Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder());

            builder = new MetadataBuilder();
            builder.AddLocalScope(MetadataTokens.MethodDefinitionHandle(1), default(ImportScopeHandle), default(LocalVariableHandle), default(LocalConstantHandle), startOffset: 0, length: 1);
            builder.AddLocalScope(MetadataTokens.MethodDefinitionHandle(1), default(ImportScopeHandle), default(LocalVariableHandle), default(LocalConstantHandle), startOffset: 0, length: 1);
            builder.ValidateOrder(); // ok
        }
开发者ID:ESgarbi,项目名称:corefx,代码行数:22,代码来源:MetadataBuilderTests.cs

示例4: ValidateInterfaceImplTable

        public void ValidateInterfaceImplTable()
        {
            var builder = new MetadataBuilder();
            builder.AddInterfaceImplementation(MetadataTokens.TypeDefinitionHandle(2), MetadataTokens.TypeDefinitionHandle(1));
            builder.AddInterfaceImplementation(MetadataTokens.TypeDefinitionHandle(1), MetadataTokens.TypeDefinitionHandle(1));
            Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder());

            builder = new MetadataBuilder();
            builder.AddInterfaceImplementation(MetadataTokens.TypeDefinitionHandle(1), MetadataTokens.TypeDefinitionHandle(1));
            builder.AddInterfaceImplementation(MetadataTokens.TypeDefinitionHandle(1), MetadataTokens.TypeDefinitionHandle(1));
            Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder());

            builder = new MetadataBuilder();
            builder.AddInterfaceImplementation(MetadataTokens.TypeDefinitionHandle(1), MetadataTokens.TypeDefinitionHandle(2));
            builder.AddInterfaceImplementation(MetadataTokens.TypeDefinitionHandle(1), MetadataTokens.TypeDefinitionHandle(1));
            Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder());

            builder = new MetadataBuilder();
            builder.AddInterfaceImplementation(MetadataTokens.TypeDefinitionHandle(1), MetadataTokens.TypeReferenceHandle(2));
            builder.AddInterfaceImplementation(MetadataTokens.TypeDefinitionHandle(1), MetadataTokens.TypeReferenceHandle(1));
            Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder());

            builder = new MetadataBuilder();
            builder.AddInterfaceImplementation(MetadataTokens.TypeDefinitionHandle(1), MetadataTokens.TypeSpecificationHandle(2));
            builder.AddInterfaceImplementation(MetadataTokens.TypeDefinitionHandle(1), MetadataTokens.TypeSpecificationHandle(1));
            Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder());

            builder = new MetadataBuilder();
            builder.AddInterfaceImplementation(MetadataTokens.TypeDefinitionHandle(1), MetadataTokens.TypeReferenceHandle(1));
            builder.AddInterfaceImplementation(MetadataTokens.TypeDefinitionHandle(1), MetadataTokens.TypeDefinitionHandle(1));
            Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder());

            builder = new MetadataBuilder();
            builder.AddInterfaceImplementation(MetadataTokens.TypeDefinitionHandle(1), MetadataTokens.TypeSpecificationHandle(1));
            builder.AddInterfaceImplementation(MetadataTokens.TypeDefinitionHandle(1), MetadataTokens.TypeReferenceHandle(1));
            Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder());

            builder = new MetadataBuilder();
            builder.AddInterfaceImplementation(MetadataTokens.TypeDefinitionHandle(1), MetadataTokens.TypeSpecificationHandle(1));
            builder.AddInterfaceImplementation(MetadataTokens.TypeDefinitionHandle(1), MetadataTokens.TypeDefinitionHandle(1));
            Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder());
        }
开发者ID:ESgarbi,项目名称:corefx,代码行数:42,代码来源:MetadataBuilderTests.cs

示例5: ValidateMethodImplTable

        public void ValidateMethodImplTable()
        {
            var builder = new MetadataBuilder();
            builder.AddMethodImplementation(MetadataTokens.TypeDefinitionHandle(2), default(MethodDefinitionHandle), default(MethodDefinitionHandle));
            builder.AddMethodImplementation(MetadataTokens.TypeDefinitionHandle(1), default(MethodDefinitionHandle), default(MethodDefinitionHandle));
            Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder());

            builder = new MetadataBuilder();
            builder.AddMethodImplementation(MetadataTokens.TypeDefinitionHandle(1), default(MethodDefinitionHandle), default(MethodDefinitionHandle));
            builder.AddMethodImplementation(MetadataTokens.TypeDefinitionHandle(1), default(MethodDefinitionHandle), default(MethodDefinitionHandle));
            builder.ValidateOrder(); // ok
        }
开发者ID:ESgarbi,项目名称:corefx,代码行数:12,代码来源:MetadataBuilderTests.cs

示例6: ValidateImplMapTable

        public void ValidateImplMapTable()
        {
            var builder = new MetadataBuilder();
            builder.AddMethodImport(MetadataTokens.MethodDefinitionHandle(2), default(MethodImportAttributes), default(StringHandle), default(ModuleReferenceHandle));
            builder.AddMethodImport(MetadataTokens.MethodDefinitionHandle(1), default(MethodImportAttributes), default(StringHandle), default(ModuleReferenceHandle));
            Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder());

            builder = new MetadataBuilder();
            builder.AddMethodImport(MetadataTokens.MethodDefinitionHandle(1), default(MethodImportAttributes), default(StringHandle), default(ModuleReferenceHandle));
            builder.AddMethodImport(MetadataTokens.MethodDefinitionHandle(1), default(MethodImportAttributes), default(StringHandle), default(ModuleReferenceHandle));
            Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder());
        }
开发者ID:ESgarbi,项目名称:corefx,代码行数:12,代码来源:MetadataBuilderTests.cs

示例7: ValidateGenericParamConstaintTable

        public void ValidateGenericParamConstaintTable()
        {
            var builder = new MetadataBuilder();
            builder.AddGenericParameterConstraint(MetadataTokens.GenericParameterHandle(2), default(TypeDefinitionHandle));
            builder.AddGenericParameterConstraint(MetadataTokens.GenericParameterHandle(1), default(TypeDefinitionHandle));
            Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder());

            builder = new MetadataBuilder();
            builder.AddGenericParameterConstraint(MetadataTokens.GenericParameterHandle(1), default(TypeDefinitionHandle));
            builder.AddGenericParameterConstraint(MetadataTokens.GenericParameterHandle(1), default(TypeDefinitionHandle));
            builder.ValidateOrder(); // ok
        }
开发者ID:ESgarbi,项目名称:corefx,代码行数:12,代码来源:MetadataBuilderTests.cs

示例8: ValidateGenericParamTable

        public void ValidateGenericParamTable()
        {
            var builder = new MetadataBuilder();
            builder.AddGenericParameter(MetadataTokens.TypeDefinitionHandle(2), default(GenericParameterAttributes), default(StringHandle), index: 0);
            builder.AddGenericParameter(MetadataTokens.TypeDefinitionHandle(1), default(GenericParameterAttributes), default(StringHandle), index: 0);
            Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder());

            builder = new MetadataBuilder();
            builder.AddGenericParameter(MetadataTokens.MethodDefinitionHandle(2), default(GenericParameterAttributes), default(StringHandle), index: 0);
            builder.AddGenericParameter(MetadataTokens.MethodDefinitionHandle(1), default(GenericParameterAttributes), default(StringHandle), index: 0);
            Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder());

            builder = new MetadataBuilder();
            builder.AddGenericParameter(MetadataTokens.MethodDefinitionHandle(2), default(GenericParameterAttributes), default(StringHandle), index: 0);
            builder.AddGenericParameter(MetadataTokens.TypeDefinitionHandle(1), default(GenericParameterAttributes), default(StringHandle), index: 0);
            Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder());

            builder = new MetadataBuilder();
            builder.AddGenericParameter(MetadataTokens.TypeDefinitionHandle(2), default(GenericParameterAttributes), default(StringHandle), index: 0);
            builder.AddGenericParameter(MetadataTokens.MethodDefinitionHandle(1), default(GenericParameterAttributes), default(StringHandle), index: 0);
            Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder());

            builder = new MetadataBuilder();
            builder.AddGenericParameter(MetadataTokens.TypeDefinitionHandle(1), default(GenericParameterAttributes), default(StringHandle), index: 0);
            builder.AddGenericParameter(MetadataTokens.TypeDefinitionHandle(1), default(GenericParameterAttributes), default(StringHandle), index: 0);
            Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder());

            builder = new MetadataBuilder();
            builder.AddGenericParameter(MetadataTokens.TypeDefinitionHandle(1), default(GenericParameterAttributes), default(StringHandle), index: 1);
            builder.AddGenericParameter(MetadataTokens.TypeDefinitionHandle(1), default(GenericParameterAttributes), default(StringHandle), index: 0);
            Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder());

            builder = new MetadataBuilder();
            builder.AddGenericParameter(MetadataTokens.MethodDefinitionHandle(1), default(GenericParameterAttributes), default(StringHandle), index: 0);
            builder.AddGenericParameter(MetadataTokens.TypeDefinitionHandle(1), default(GenericParameterAttributes), default(StringHandle), index: 0);
            Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder());
        }
开发者ID:ESgarbi,项目名称:corefx,代码行数:37,代码来源:MetadataBuilderTests.cs

示例9: ValidateFieldRvaTable

        public void ValidateFieldRvaTable()
        {
            var builder = new MetadataBuilder();
            builder.AddFieldRelativeVirtualAddress(MetadataTokens.FieldDefinitionHandle(2), 1);
            builder.AddFieldRelativeVirtualAddress(MetadataTokens.FieldDefinitionHandle(1), 1);
            Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder());

            builder = new MetadataBuilder();
            builder.AddFieldRelativeVirtualAddress(MetadataTokens.FieldDefinitionHandle(1), 1);
            builder.AddFieldRelativeVirtualAddress(MetadataTokens.FieldDefinitionHandle(1), 1);
            Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder());
        }
开发者ID:ESgarbi,项目名称:corefx,代码行数:12,代码来源:MetadataBuilderTests.cs

示例10: ValidateClassLayoutTable

        public void ValidateClassLayoutTable()
        {
            var builder = new MetadataBuilder();
            builder.AddTypeLayout(MetadataTokens.TypeDefinitionHandle(2), 1, 1);
            builder.AddTypeLayout(MetadataTokens.TypeDefinitionHandle(1), 1, 1);
            Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder());

            builder = new MetadataBuilder();
            builder.AddTypeLayout(MetadataTokens.TypeDefinitionHandle(1), 1, 1);
            builder.AddTypeLayout(MetadataTokens.TypeDefinitionHandle(1), 1, 1);
            Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder());
        }
开发者ID:ESgarbi,项目名称:corefx,代码行数:12,代码来源:MetadataBuilderTests.cs


注:本文中的MetadataBuilder.ValidateOrder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。