Hi All,

I'm trying to port apache avro to .NET core.

Here's the repository for the project

https://github.com/welly87/Apache-Avro-Core


However i found that some of the class and method is missing regarding
Assembly loading and IL generation. I'm really close to completing the
porting.

[image: Inline image 1]

#1. Is there any replacement on this line of code in .NET core ?
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();

#2. Another one is IL Generator. Any idea how to replace this code ?

        public CtorDelegate GetConstructor(string name, Schema.Type
schemaType, Type type)
        {
            ConstructorInfo ctorInfo = type.GetConstructor(Type.EmptyTypes);
            if (ctorInfo == null)
                throw new AvroException("Class " + name + " has no default
constructor");

            DynamicMethod dynMethod = new DynamicMethod("DM$OBJ_FACTORY_" +
name, typeof(object), null, type, true);
            ILGenerator ilGen = dynMethod.GetILGenerator();
            ilGen.Emit(OpCodes.Nop);
            ilGen.Emit(OpCodes.Newobj, ctorInfo);
            ilGen.Emit(OpCodes.Ret);

            return (CtorDelegate)dynMethod.CreateDelegate(ctorType);
        }

Thanks

Cheers
-- 
Welly Tambunan
Triplelands

http://weltam.wordpress.com
http://www.triplelands.com <http://www.triplelands.com/blog/>

Reply via email to