c# - Npgsql.NpgsqlConnection doesn't implement interface System.Collections.IEnumerator -
in visual studio created simple vnext console app , installed npgsql
install-package npgsql
command.
here code, program.cs , project.json
using npgsql; using system; namespace consoleapp3 { public class program { public void main(string[] args) { console.writeline("hello postgresql!"); // specify connection options , open connection npgsqlconnection conn = new npgsqlconnection("server=myserv;user id=postgres;" + "password=postgres;database=mydb;"); conn.open(); // define query npgsqlcommand cmd = new npgsqlcommand("select name mytb", conn); // execute query npgsqldatareader dr = cmd.executereader(); // read rows , output first column in each row while (dr.read()) console.write("{0}\n", dr[0]); // close connection conn.close(); console.readline(); } } } { "version": "1.0.0-*", "dependencies": { "npgsql": "2.2.4.3", "system.data.common": "4.0.0-beta-22605" }, "commands": { "consoleapp3": "run" }, "frameworks": { "aspnet50": { "frameworkassemblies": { "system.data": "4.0.0.0" } } }
}
all working fine.
then copied code on machine mono , debian os.
mono --version mono jit compiler version 3.12.1 (tarball fri mar 6 19:12:47 utc 2015) copyright (c) 2002-2014 novell, inc, xamarin inc , contributors. www.mono- project.com tls: __thread sigsegv: altstack notifications: epoll architecture: amd64 disabled: none misc: softdebug llvm: supported, not enabled. gc: sgen
then made
kpm restore
and
k run
and got exception:
hello postgresql! npgsql.npgsqlconnection doesn't implement interface system.collections.ienumerator stacktrace: @ <unknown> <0xffffffff> @ consoleapp3.program.main (string[]) <0x0004c> @ (wrapper runtime-invoke) <module>.runtime_invoke_void__this___object (object,intptr,intptr,intptr) <0xffffffff> @ <unknown> <0xffffffff> @ (wrapper managed-to-native) system.reflection.monomethod.internalinvoke (system.reflection.monomethod,object,object[],system.exception&) <0xffffffff> @ system.reflection.monomethod.invoke (object,system.reflection.bindingflags,system.reflection.binder,object[],system.globalization.cultureinfo) <0x000d7> @ system.reflection.methodbase.invoke (object,object[]) <0x0002a> @ microsoft.framework.runtime.common.entrypointexecutor.execute (system.reflection.assembly,string[],system.iserviceprovider) <0x0010b> @ microsoft.framework.applicationhost.program.executemain (microsoft.framework.runtime.defaulthost,string,string[]) <0x0026f> @ microsoft.framework.applicationhost.program.main (string[]) <0x0043f> @ (wrapper runtime-invoke) <module>.runtime_invoke_object__this___object (object,intptr,intptr,intptr) <0xffffffff> @ <unknown> <0xffffffff> @ (wrapper managed-to-native) system.reflection.monomethod.internalinvoke (system.reflection.monomethod,object,object[],system.exception&) <0xffffffff> @ system.reflection.monomethod.invoke (object,system.reflection.bindingflags,system.reflection.binder,object[],system.globalization.cultureinfo) <0x000d7> @ system.reflection.methodbase.invoke (object,object[]) <0x0002a> @ microsoft.framework.runtime.common.entrypointexecutor.execute (system.reflection.assembly,string[],system.iserviceprovider) <0x0010b> @ kre.host.bootstrapper.main (string[]) <0x002f3> @ (wrapper runtime-invoke) <module>.runtime_invoke_object__this___object (object,intptr,intptr,intptr) <0xffffffff> @ <unknown> <0xffffffff> @ (wrapper managed-to-native) system.reflection.monomethod.internalinvoke (system.reflection.monomethod,object,object[],system.exception&) <0xffffffff> @ system.reflection.monomethod.invoke (object,system.reflection.bindingflags,system.reflection.binder,object[],system.globalization.cultureinfo) <0x000d7> @ system.reflection.methodbase.invoke (object,object[]) <0x0002a> @ kre.hosting.runtimebootstrapper.executeasync (string[]) <0x01667> @ kre.hosting.runtimebootstrapper.execute (string[]) <0x00053> @ entrypoint.main (string[]) <0x00167> @ (wrapper runtime-invoke) <module>.runtime_invoke_int_object (object,intptr,intptr,intptr) <0xffffffff> native stacktrace: mono() [0x4accac] /lib/x86_64-linux-gnu/libpthread.so.0(+0xf0a0) [0x7f03a02c60a0] /lib/x86_64-linux-gnu/libc.so.6(gsignal+0x35) [0x7f039ff5e165] /lib/x86_64-linux-gnu/libc.so.6(abort+0x180) [0x7f039ff613e0] mono() [0x6232f9] mono() [0x623507] mono() [0x6235b2] mono() [0x4aebe7] mono() [0x4af3c3] [0x40ef3de6] debug info gdb: ================================================================= got sigabrt while executing native code. indicates fatal error in mono runtime or 1 of native libraries used application. ================================================================= aborted
anybody has ideas how handle it?
problem in old version npgsql.dll, stored in mono gac. bootloader used old binaries instead brand new npgsql.dll nuget package.
Comments
Post a Comment