Okay well, the problem occurs under amd64 system only. The problem is
around the marshal of the virConnectCredential structure.
I have marshalled it as this:
///<summary>
/// Credential structure
///</summary>
[StructLayout(LayoutKind.Sequential)]
public struct virConnectCredential
{
///<summary>
/// One of virConnectCredentialType constants
///</summary>
[MarshalAs(UnmanagedType.I4)]
public virConnectCredentialType type;
///<summary>
/// Prompt to show to user
///</summary>
private IntPtr prompt;
///<summary>
/// Additional challenge to show
///</summary>
private IntPtr challenge;
///<summary>
/// Optional default result
///</summary>
private IntPtr defresult;
///<summary>
/// Result to be filled with user response (or defresult). An IntPtr
to a marshalled allocated string
///</summary>
private IntPtr result;
///<summary>
/// Length of the result
///</summary>
[MarshalAs(UnmanagedType.U4)]
public uint resultlen;
///<summary>
/// Prompt to show to user
///</summary>
public string Prompt
{
get
{
return Marshal.PtrToStringAnsi(prompt);
}
}
///<summary>
/// Additional challenge to show
///</summary>
public string Challenge
{
get
{
return Marshal.PtrToStringAnsi(challenge);
}
}
///<summary>
/// Optional default result
///</summary>
public string Defresult
{
get
{
return Marshal.PtrToStringAnsi(defresult);
}
}
///<summary>
/// Result to be filled with user response (or defresult).
///</summary>
public string Result
{
get
{
return Marshal.PtrToStringAnsi(result);
}
set
{
result =
NativeFunctions.StrDup(Marshal.StringToHGlobalAnsi(value));
}
}
}
The strange thing is that I have made test with this marshaling, it always
work with on x86 (fedora or ubuntu) and failed marshaling on amd64 (ubuntu
or fedora)
Anyone have an idea ?
Regards,
Arnaud
--------------------------------------------------
From: "Matthias Bolte" <matthias.bolte(a)googlemail.com>
Sent: Thursday, October 21, 2010 3:59 PM
To: <arnaud.champion(a)devatom.fr>
Cc: <libvir-list(a)redhat.com>
Subject: Re: [libvirt] [PATCH] C# Bindings - rename classes fromvirConnectto
Connect, virDomain to Domain, etc...
I think I have Mono AMD64 here as I'm running the AMD64 version
of Ubuntu
10.04.
Matthias
2010/10/21 <arnaud.champion(a)devatom.fr>:
> Another question, are you using a x86 or a amd64 version of mono ?
>
> --------------------------------------------------
> From: <arnaud.champion(a)devatom.fr>
> Sent: Thursday, October 21, 2010 3:07 PM
> To: <arnaud.champion(a)devatom.fr>; "Matthias Bolte"
> <matthias.bolte(a)googlemail.com>
> Cc: <libvir-list(a)redhat.com>
> Subject: Re: [libvirt] [PATCH] C# Bindings - rename classes
> fromvirConnectto
> Connect, virDomain to Domain, etc...
>
>> Solved, I have compiled with --disable-nls and I have reproduced the
>> problem, but I have a lot of difficulties to find the solution, for
>> now...
>> but I continue to search.
>>
>> --------------------------------------------------
>> From: <arnaud.champion(a)devatom.fr>
>> Sent: Thursday, October 21, 2010 10:57 AM
>> To: <arnaud.champion(a)devatom.fr>; "Matthias Bolte"
>> <matthias.bolte(a)googlemail.com>
>> Cc: <libvir-list(a)redhat.com>
>> Subject: Re: [libvirt] [PATCH] C# Bindings - rename classes
>> fromvirConnectto Connect, virDomain to Domain, etc...
>>
>>> I have a compile problem under ubuntu 10.04.
>>>
>>> I have used the git libvirt version. autogen run fine (I haven't used
>>> any
>>> argument, so I try to compile all). But make give me this :
>>>
>>> make[3]: Leaving directory `/home/arnaud/Bureau/libvirt/libvirt/tests'
>>> make[2]: Leaving directory `/home/arnaud/Bureau/libvirt/libvirt/tests'
>>> Making all in po
>>> make[2]: Entering directory `/home/arnaud/Bureau/libvirt/libvirt/po'
>>> test -z "af.gmo am.gmo ar.gmo as.gmo be.gmo bg.gmo bn.gmo bn_IN.gmo
>>> bs.gmo ca.gmo cs.gmo cy.gmo da.gmo de.gmo el.gmo en_GB.gmo es.gmo
>>> et.gmo
>>> eu_ES.gmo fa.gmo fi.gmo fr.gmo gl.gmo gu.gmo he.gmo hi.gmo hr.gmo
>>> hu.gmo
>>> hy.gmo id.gmo is.gmo it.gmo ja.gmo ka.gmo kn.gmo ko.gmo ku.gmo lo.gmo
>>> lt.gmo
>>> lv.gmo mk.gmo ml.gmo mr.gmo ms.gmo my.gmo nb.gmo nl.gmo nn.gmo nso.gmo
>>> or.gmo pa.gmo pl.gmo pt.gmo pt_BR.gmo ro.gmo ru.gmo si.gmo sk.gmo
>>> sl.gmo
>>> sq.gmo sr.gmo sr(a)latin.gmo sv.gmo ta.gmo te.gmo th.gmo tr.gmo uk.gmo
>>> ur.gmo
>>> vi.gmo zh_CN.gmo zh_TW.gmo zu.gmo" || make af.gmo am.gmo ar.gmo as.gmo
>>> be.gmo bg.gmo bn.gmo bn_IN.gmo bs.gmo ca.gmo cs.gmo cy.gmo da.gmo
>>> de.gmo
>>> el.gmo en_GB.gmo es.gmo et.gmo eu_ES.gmo fa.gmo fi.gmo fr.gmo gl.gmo
>>> gu.gmo
>>> he.gmo hi.gmo hr.gmo hu.gmo hy.gmo id.gmo is.gmo it.gmo ja.gmo ka.gmo
>>> kn.gmo
>>> ko.gmo ku.gmo lo.gmo lt.gmo lv.gmo mk.gmo ml.gmo mr.gmo ms.gmo my.gmo
>>> nb.gmo
>>> nl.gmo nn.gmo nso.gmo or.gmo pa.gmo pl.gmo pt.gmo pt_BR.gmo ro.gmo
>>> ru.gmo
>>> si.gmo sk.gmo sl.gmo sq.gmo sr.gmo sr(a)latin.gmo sv.gmo ta.gmo te.gmo
>>> th.gmo
>>> tr.gmo uk.gmo ur.gmo vi.gmo zh_CN.gmo zh_TW.gmo zu.gmo
>>> make[3]: Entering directory `/home/arnaud/Bureau/libvirt/libvirt/po'
>>> : --update af.po libvirt.pot
>>> rm -f af.gmo && : -c --statistics -o af.gmo af.po
>>> mv: cannot stat `t-af.gmo': No such file or directory
>>> make[3]: *** [af.gmo] Error 1
>>> make[3]: Leaving directory `/home/arnaud/Bureau/libvirt/libvirt/po'
>>> make[2]: *** [stamp-po] Error 2
>>> make[2]: Leaving directory `/home/arnaud/Bureau/libvirt/libvirt/po'
>>> make[1]: *** [all-recursive] Error 1
>>> make[1]: Leaving directory `/home/arnaud/Bureau/libvirt/libvirt'
>>> make: *** [all] Erreur 2
>>>
>>> Maybe I have to remove certains things via --without at configure, but
>>> I
>>> don't know what.
>>>
>>> Arnaud
>>>
>>> --------------------------------------------------
>>> From: <arnaud.champion(a)devatom.fr>
>>> Sent: Thursday, October 21, 2010 10:28 AM
>>> To: "Matthias Bolte" <matthias.bolte(a)googlemail.com>
>>> Cc: <libvir-list(a)redhat.com>
>>> Subject: Re: [libvirt] [PATCH] C# Bindings - rename classes
>>> fromvirConnectto Connect, virDomain to Domain, etc...
>>>
>>>> argh, esx support is not compiled by default in ubuntu. I have to take
>>>> the time to compile libvirt.
>>>>
>>>> --------------------------------------------------
>>>> From: "Matthias Bolte" <matthias.bolte(a)googlemail.com>
>>>> Sent: Wednesday, October 20, 2010 11:23 PM
>>>> To: <arnaud.champion(a)devatom.fr>
>>>> Cc: <libvir-list(a)redhat.com>
>>>> Subject: Re: [libvirt] [PATCH] C# Bindings - rename classes from
>>>> virConnectto Connect, virDomain to Domain, etc...
>>>>
>>>>> I'm testing on Ubuntu 10.04 with
>>>>>
>>>>> mono 2.4.4~svn151842-1ubuntu4
>>>>> monodevelop 2.2.1+dfsg-1ubuntu2
>>>>>
>>>>> and libvirt and libvirt-csharp from git.
>>>>>
>>>>> Matthias
>>>>>
>>>>> 2010/10/20 <arnaud.champion(a)devatom.fr>:
>>>>>>
>>>>>> It seems that the marshaling of the virConnectCredential
structure
>>>>>> failed,
>>>>>> but I only said that by view your debug traces. Can you say me
which
>>>>>> are the
>>>>>> environment of Mono (which version of Mono, which MonoDevelop,
these
>>>>>> kind of
>>>>>> things) ? because I have no idea about what's going wrong, I
have to
>>>>>> reproduce the case on my system to debug correctly.
>>>>>>
>>>>>> Arnaud
>>>>>>
>>>>>> --------------------------------------------------
>>>>>> From: <arnaud.champion(a)devatom.fr>
>>>>>> Sent: Wednesday, October 20, 2010 9:07 PM
>>>>>> To: "Matthias Bolte"
<matthias.bolte(a)googlemail.com>
>>>>>> Cc: <libvir-list(a)redhat.com>
>>>>>> Subject: Re: [libvirt] [PATCH] C# Bindings - rename classes from
>>>>>> virConnectto Connect, virDomain to Domain, etc...
>>>>>>
>>>>>>> It's strange it works on my linux :S
>>>>>>>
>>>>>>> --------------------------------------------------
>>>>>>> From: "Matthias Bolte"
<matthias.bolte(a)googlemail.com>
>>>>>>> Sent: Wednesday, October 20, 2010 8:02 PM
>>>>>>> To: <arnaud.champion(a)devatom.fr>
>>>>>>> Cc: <libvir-list(a)redhat.com>
>>>>>>> Subject: Re: [libvirt] [PATCH] C# Bindings - rename classes
from
>>>>>>> virConnect to Connect, virDomain to Domain, etc...
>>>>>>>
>>>>>>>> The transport shouldn't make a difference. To make it
work with
>>>>>>>> HTTPS
>>>>>>>> you'll have to replace the self-signed certificates
on the ESX
>>>>>>>> server
>>>>>>>> or tell libvirt to disable server certificate checks
using:
>>>>>>>>
>>>>>>>> esx://192.168.0.17/?no_verify=1
>>>>>>>>
>>>>>>>> Matthias
>>>>>>>>
>>>>>>>> 2010/10/20 <arnaud.champion(a)devatom.fr>:
>>>>>>>>>
>>>>>>>>> Okay I'll take a look, is the transport in http ?
(just to be
>>>>>>>>> curious, I
>>>>>>>>> haven't been able to make it work in https)
>>>>>>>>>
>>>>>>>>> --------------------------------------------------
>>>>>>>>> From: "Matthias Bolte"
<matthias.bolte(a)googlemail.com>
>>>>>>>>> Sent: Wednesday, October 20, 2010 6:35 PM
>>>>>>>>> To: <arnaud.champion(a)devatom.fr>
>>>>>>>>> Cc: <libvir-list(a)redhat.com>
>>>>>>>>> Subject: Re: [libvirt] [PATCH] C# Bindings - rename
classes from
>>>>>>>>> virConnect
>>>>>>>>> to Connect, virDomain to Domain, etc...
>>>>>>>>>
>>>>>>>>>> 2010/10/20 <arnaud.champion(a)devatom.fr>:
>>>>>>>>>>>
>>>>>>>>>>> This patch rename file / classes from
virConnect to Connect,
>>>>>>>>>>> virDomain
>>>>>>>>>>> to
>>>>>>>>>>> Domain, etc...
>>>>>>>>>>>
>>>>>>>>>>> Arnaud
>>>>>>>>>>
>>>>>>>>>> I pushed this one too and did a patch remove
trailing white
>>>>>>>>>> spaces
>>>>>>>>>> on
>>>>>>>>>> top.
>>>>>>>>>>
>>>>>>>>>> I tested the bindings by successfully compiling
and using the
>>>>>>>>>> virConnectOpen example on Linux in MonoDevelop.
>>>>>>>>>>
>>>>>>>>>> The virConnectOpenAuth example throws a
>>>>>>>>>> System.NullReferenceException
>>>>>>>>>> when I try to connect to an ESX server.
>>>>>>>>>>
>>>>>>>>>> Marshaling clicked signal
>>>>>>>>>> Exception in Gtk# callback delegate
>>>>>>>>>> Note: Applications can use
>>>>>>>>>> GLib.ExceptionManager.UnhandledException
>>>>>>>>>> to handle the exception.
>>>>>>>>>> System.Reflection.TargetInvocationException:
Exception has been
>>>>>>>>>> thrown
>>>>>>>>>> by the target of an invocation. --->
>>>>>>>>>> System.NullReferenceException:
>>>>>>>>>> Object reference not set to an instance of an
object
>>>>>>>>>> at System.String.memcpy4 (System.Byte* dest,
System.Byte* src,
>>>>>>>>>> Int32
>>>>>>>>>> size) [0x00000]
>>>>>>>>>> at System.String.memcpy (System.Byte* dest,
System.Byte* src,
>>>>>>>>>> Int32
>>>>>>>>>> size) [0x00000]
>>>>>>>>>> at (wrapper unknown)
>>>>>>>>>> Libvirt.virConnectCredential:PtrToStructure
>>>>>>>>>> (intptr,object)
>>>>>>>>>> at (wrapper managed-to-native)
>>>>>>>>>>
System.Runtime.InteropServices.Marshal:PtrToStructure
>>>>>>>>>> (intptr,System.Type)
>>>>>>>>>> at MainWindow.AuthCallback (IntPtr creds, UInt32
ncred, IntPtr
>>>>>>>>>> cbdata) [0x00034] in
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
.../libvirt-csharp-upstream/examples/MonoDevelop/virConnectOpenAuth/MainWindow.cs:146
>>>>>>>>>> at (wrapper native-to-managed)
MainWindow:AuthCallback
>>>>>>>>>> (intptr,uint,intptr)
>>>>>>>>>> at (wrapper managed-to-native)
Libvirt.Connect:OpenAuth
>>>>>>>>>> (string,Libvirt.virConnectAuth&,int)
>>>>>>>>>> at MainWindow.OnButton1Clicked (System.Object
sender,
>>>>>>>>>> System.EventArgs e) [0x00069] in
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
.../libvirt-csharp-upstream/examples/MonoDevelop/virConnectOpenAuth/MainWindow.cs:64
>>>>>>>>>> at (wrapper managed-to-native)
>>>>>>>>>> System.Reflection.MonoMethod:InternalInvoke
>>>>>>>>>> (object,object[],System.Exception&)
>>>>>>>>>> at System.Reflection.MonoMethod.Invoke
(System.Object obj,
>>>>>>>>>> BindingFlags invokeAttr, System.Reflection.Binder
binder,
>>>>>>>>>> System.Object[] parameters,
System.Globalization.CultureInfo
>>>>>>>>>> culture)
>>>>>>>>>> [0x00000]
>>>>>>>>>> --- End of inner exception stack trace ---
>>>>>>>>>> at System.Reflection.MonoMethod.Invoke
(System.Object obj,
>>>>>>>>>> BindingFlags invokeAttr, System.Reflection.Binder
binder,
>>>>>>>>>> System.Object[] parameters,
System.Globalization.CultureInfo
>>>>>>>>>> culture)
>>>>>>>>>> [0x00000]
>>>>>>>>>> at System.Reflection.MethodBase.Invoke
(System.Object obj,
>>>>>>>>>> System.Object[] parameters) [0x00000]
>>>>>>>>>> at System.Delegate.DynamicInvokeImpl
(System.Object[] args)
>>>>>>>>>> [0x00000]
>>>>>>>>>> at System.MulticastDelegate.DynamicInvokeImpl
(System.Object[]
>>>>>>>>>> args)
>>>>>>>>>> [0x00000]
>>>>>>>>>> at System.Delegate.DynamicInvoke
(System.Object[] args)
>>>>>>>>>> [0x00000]
>>>>>>>>>> at GLib.Signal.ClosureInvokedCB (System.Object
o,
>>>>>>>>>> GLib.ClosureInvokedArgs args) [0x00000]
>>>>>>>>>> at GLib.SignalClosure.Invoke
(GLib.ClosureInvokedArgs args)
>>>>>>>>>> [0x00000]
>>>>>>>>>> at GLib.SignalClosure.MarshalCallback (IntPtr
raw_closure,
>>>>>>>>>> IntPtr
>>>>>>>>>> return_val, UInt32 n_param_vals, IntPtr
param_values, IntPtr
>>>>>>>>>> invocation_hint, IntPtr marshal_data) [0x00000]
>>>>>>>>>> at
>>>>>>>>>>
GLib.ExceptionManager.RaiseUnhandledException(System.Exception
>>>>>>>>>> e, Boolean is_terminal)
>>>>>>>>>> at GLib.SignalClosure.MarshalCallback(IntPtr
raw_closure,
>>>>>>>>>> IntPtr
>>>>>>>>>> return_val, UInt32 n_param_vals, IntPtr
param_values, IntPtr
>>>>>>>>>> invocation_hint, IntPtr marshal_data)
>>>>>>>>>> at Gtk.Application.gtk_main()
>>>>>>>>>> at Gtk.Application.Run()
>>>>>>>>>> at
virConnectOpenAuth.MainClass.Main(System.String[] args) in
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
.../libvirt-csharp-upstream/examples/MonoDevelop/virConnectOpenAuth/Main.cs:line
>>>>>>>>>> 13
>>>>>>>>>>
>>>>>>>>>> Matthias
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> libvir-list mailing list
>>>>>>> libvir-list(a)redhat.com
>>>>>>>
https://www.redhat.com/mailman/listinfo/libvir-list
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>> --
>>>> libvir-list mailing list
>>>> libvir-list(a)redhat.com
>>>>
https://www.redhat.com/mailman/listinfo/libvir-list
>>>
>>>
>>
>
>