public static void CallEqualsAfterDisposing() { AssemblyDebugging assembly = null; using (assembly = AssemblyCreationTests.CreateDebuggingAssembly("Me")) { } Assert.Throws <ObjectDisposedException>(() => assembly.GetTypeDebugging(null)); }
public static void CallDisposeAfterDisposing() { AssemblyDebugging assembly = null; using (assembly = AssemblyCreationTests.CreateDebuggingAssembly("Me")) { } assembly.Dispose(); }
public static void CallGetMethodDebuggingWithMethodBuilderAfterDisposing() { TypeDebugging type = null; using (var assembly = AssemblyCreationTests.CreateDebuggingAssembly("Me")) { using (type = AssemblyCreationTests.CreateDebuggingType(assembly, assembly.Builder.GetDynamicModule("Me"), "Type")) { } Assert.Throws <ObjectDisposedException>(() => type.GetMethodDebugging(null as MethodBuilder)); } }
public static void CallDisposeAfterDisposing() { TypeDebugging type = null; using (var assembly = AssemblyCreationTests.CreateDebuggingAssembly("Me")) { using (type = AssemblyCreationTests.CreateDebuggingType(assembly, assembly.Builder.GetDynamicModule("Me"), "Type")) { } type.Dispose(); } }
public static void GetTypeBuilderDescription() { using (var assembly = AssemblyCreationTests.CreateDebuggingAssembly("TypeBuilderDescriptor")) { using (var type = AssemblyCreationTests.CreateDebuggingType( assembly, assembly.Builder.GetDynamicModule(assembly.Builder.GetName().Name), "Holder")) { var descriptor = new TypeDescriptor(type.Builder); Assert.Equal("class TypeBuilderDescriptor.Holder", descriptor.Value); } } }
public static void GetGenericTypeBuilderDescription() { using (var assembly = AssemblyCreationTests.CreateDebuggingAssembly("GenericTypeBuilderDescriptor")) { using (var type = AssemblyCreationTests.CreateDebuggingType( assembly, assembly.Builder.GetDynamicModule(assembly.Builder.GetName().Name), "Holder")) { type.Builder.DefineGenericParameters("T", "U", "V"); var descriptor = new TypeDescriptor(type.Builder); Assert.Equal("class GenericTypeBuilderDescriptor.Holder`3<T, U, V>", descriptor.Value); } } }
private static MethodDebugging GetMethod() { MethodDebugging method = null; var name = Guid.NewGuid().ToString("N"); using (var assembly = AssemblyCreationTests.CreateDebuggingAssembly(name)) { using (var type = AssemblyCreationTests.CreateDebuggingType( assembly, assembly.Builder.GetDynamicModule(name), "Type")) { using (method = type.GetMethodDebugging( type.Builder.DefineMethod("Method", MethodAttributes.Public | MethodAttributes.Static))) { } } } return(method); }
public static void GetDescriptionFromMethodBuilder() { using (var assembly = AssemblyCreationTests.CreateDebuggingAssembly("BuilderGenericDeclaration")) { using (var type = AssemblyCreationTests.CreateDebuggingType( assembly, assembly.Builder.GetDynamicModule(assembly.Builder.GetName().Name), "Holder")) { using (var method = type.GetMethodDebugging( type.Builder.DefineMethod("Method", MethodAttributes.HideBySig | MethodAttributes.Public))) { var descriptor = MethodDescriptorFactory.Create(method.Builder, true); Assert.Equal(typeof(MethodDescriptor), descriptor.GetType()); Assert.Equal(".method public hidebysig instance void Method() cil managed", descriptor.Value); } } } }