Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 735DF200B7E for ; Tue, 6 Sep 2016 19:17:30 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 720B6160ACB; Tue, 6 Sep 2016 17:17:30 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 9113F160AA9 for ; Tue, 6 Sep 2016 19:17:29 +0200 (CEST) Received: (qmail 53516 invoked by uid 500); 6 Sep 2016 17:17:28 -0000 Mailing-List: contact user-help@avro.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@avro.apache.org Delivered-To: mailing list user@avro.apache.org Received: (qmail 53506 invoked by uid 99); 6 Sep 2016 17:17:28 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Sep 2016 17:17:28 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id DB1B31A7B1C for ; Tue, 6 Sep 2016 17:17:27 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.198 X-Spam-Level: * X-Spam-Status: No, score=1.198 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (1024-bit key) header.d=netflix.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id NLsQXiaHKISo for ; Tue, 6 Sep 2016 17:17:25 +0000 (UTC) Received: from mail-pf0-f177.google.com (mail-pf0-f177.google.com [209.85.192.177]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 39F6460CD1 for ; Tue, 6 Sep 2016 17:17:24 +0000 (UTC) Received: by mail-pf0-f177.google.com with SMTP id p64so76410247pfb.1 for ; Tue, 06 Sep 2016 10:17:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netflix.com; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=EVeD9g+Jx7tFFaM6Y2hSXvZcH892D+4+ELKm7s/HssA=; b=Gk/RECgNoHQZzCJteFvpWh+WjLI21s0w+IJawiLtdMpEy2f5msIel8AxKPO/WBDwbO GXQQX6OlsjikSyiSqLDFLlFP/JsKxoqU23UgbX/WC1KKYGtdlopRx9jGcz+4kX8jxAFU ojJUzcX2x/9+QxAsXWxVqT+RkBp+XczqKunBE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=EVeD9g+Jx7tFFaM6Y2hSXvZcH892D+4+ELKm7s/HssA=; b=bRqbDbFfL6xyxFVg2xOlHgIgtYc7n54bOH2X1zhA3H8ZEIICUju7KA3LABU/jU8MLX pCgy8c/6a5ZH+TPTsBs2rRgwtyB8V+u1gS0N+cxWHee5p6KxGNKiVFnK7BbnIeKilGTH MST3mzS7HdpCfkaysmyeK84z4QigyG3UdVajQlKxb7UFG1WCAkgbsxsCD6IVVh4TVAzs QrqjF0+VJKfvV5NAn3rHvWh/Gqlh5MX+PjV0jnasqQi/foYVdGWpiy1GLvhyBUhqkaG9 yW5pMj+uv1S0HogruepilKrFIlQoVM3xPrzGRmGwqenyNNrYCyNoSeRoyLT2YrbirOI3 XBLQ== X-Gm-Message-State: AE9vXwOp/0Pezm/XBqol23/aL00WeOoeh1h7jSjkgy9c+RS2+7rRI2UXtRIyocgT39/KYhWDBabug9kXjVn1am3c X-Received: by 10.98.86.154 with SMTP id h26mr74870481pfj.22.1473182242911; Tue, 06 Sep 2016 10:17:22 -0700 (PDT) MIME-Version: 1.0 Received: by 10.66.167.165 with HTTP; Tue, 6 Sep 2016 10:16:52 -0700 (PDT) In-Reply-To: References: From: Ryan Blue Date: Tue, 6 Sep 2016 10:16:52 -0700 Message-ID: Subject: Re: Apache Avro to .NET Core To: Avro Dev List Cc: user@avro.apache.org Content-Type: multipart/alternative; boundary=001a114298ec474f05053bd9f8a7 archived-at: Tue, 06 Sep 2016 17:17:30 -0000 --001a114298ec474f05053bd9f8a7 Content-Type: text/plain; charset=UTF-8 Hi Welly, I'm not very familiar with .NET or the C# Avro library, hopefully others can help answer your specific question. One alternative is to look at the Microsoft C# library, which also has codegen features and is intended for use for .NET: https://azure.microsoft.com/en-us/updates/microsoft-avro-library-updated-to-include-c-code-generator/ rb On Mon, Sep 5, 2016 at 5:12 AM, Welly Tambunan wrote: > 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.Empty > Types); > 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 > -- Ryan Blue Software Engineer Netflix --001a114298ec474f05053bd9f8a7 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Welly,

I'm not very familiar wit= h .NET or the C# Avro library, hopefully others can help answer your specif= ic question. One alternative is to look at the Microsoft C# library, which = also has codegen features and is intended for use for .NET:

On Mon, Sep 5, 2016 at 5:12 AM, Welly= Tambunan <if05041@gmail.com> wrote:
Hi All,=C2=A0

I'm trying= to port apache avro to .NET core.=C2=A0

Here'= s the repository for the project=C2=A0



However i found that some of the class and method is m= issing regarding Assembly loading and IL generation. I'm really close t= o completing the porting.=C2=A0

3D"Inline=

#1. Is there any replacement on this line of code i= n .NET core ?=C2=A0
Assembly[] assemblies =3D AppDomain.CurrentDomain.GetAssemblies();

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

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

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

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (Cto= rDelegate)dynMethod.CreateDelegate(ctorType);
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 }

=
Thanks

Cheers
--



--
Ryan Blue
Software Engineer
Netflix
--001a114298ec474f05053bd9f8a7--