GtkPrint on Windows

View: New views
5 Messages — Rating Filter:   Alert me  

GtkPrint on Windows

by Milton Pividori-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi! I have an application which runs well on Linux but fails on Windows
XP. I tried with Gtk# installer (latest) with .NET 3.5, and with Mono
2.4.3, but I get the same exception:

System.EntryPointNotFoundException: gtk_enumerate_printers
  at (wrapper managed-to-native) Gtk.Printer:gtk_enumerate_printers (GtkSharp.PrinterFuncNative,intptr,GLib.DestroyNotify,bool)
  at Gtk.Printer.EnumeratePrinters (Gtk.PrinterFunc func, Boolean wait) [0x00000]
  at StratosClient.ServicioFacturacion.SolapaServicioImpresion..ctor () [0x00000]
  at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (object,object[],System.Exception&)
  at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] : gtk_enumerate_printers

  at (wrapper managed-to-native) Gtk.Printer:gtk_enumerate_printers (GtkSharp.PrinterFuncNative,intptr,GLib.DestroyNotify,bool)
  at Gtk.Printer.EnumeratePrinters (Gtk.PrinterFunc func, Boolean wait) [0x00000]
  at StratosClient.ServicioFacturacion.SolapaServicioImpresion..ctor () [0x00000]
  at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (object,object[],System.Exception&)
  at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000]

I tried to use the latest bundle of Gtk+ but the same exception is
thrown. I suspect if Gtk Print works ok on Windows.

Any idea? Thanks!

--
Milton Pividori
Blog: http://www.miltonpividori.com.ar
Jabber ID: miltondp@...
GnuPG Public Key: gpg --keyserver subkeys.pgp.net --recv-key 0x663C185C

_______________________________________________
Gtk-sharp-list maillist  -  Gtk-sharp-list@...
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

Re: GtkPrint on Windows

by Christian Hoff :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Milton Pividori wrote:

> Hi! I have an application which runs well on Linux but fails on Windows
> XP. I tried with Gtk# installer (latest) with .NET 3.5, and with Mono
> 2.4.3, but I get the same exception:
>
> System.EntryPointNotFoundException: gtk_enumerate_printers
>   at (wrapper managed-to-native) Gtk.Printer:gtk_enumerate_printers (GtkSharp.PrinterFuncNative,intptr,GLib.DestroyNotify,bool)
>   at Gtk.Printer.EnumeratePrinters (Gtk.PrinterFunc func, Boolean wait) [0x00000]
>   at StratosClient.ServicioFacturacion.SolapaServicioImpresion..ctor () [0x00000]
>   at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (object,object[],System.Exception&)
>   at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] : gtk_enumerate_printers
>
>   at (wrapper managed-to-native) Gtk.Printer:gtk_enumerate_printers (GtkSharp.PrinterFuncNative,intptr,GLib.DestroyNotify,bool)
>   at Gtk.Printer.EnumeratePrinters (Gtk.PrinterFunc func, Boolean wait) [0x00000]
>   at StratosClient.ServicioFacturacion.SolapaServicioImpresion..ctor () [0x00000]
>   at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (object,object[],System.Exception&)
>   at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000]
>
> I tried to use the latest bundle of Gtk+ but the same exception is
> thrown. I suspect if Gtk Print works ok on Windows.
>  
Looking into the stack trace, the problem seems that your code is
infinetly recurse:

SolapaServicioImpresion..ctor -> calls EnumeratePrinters -> calls
solapaServicioImpresion..ctor-> calls EnumeratePrinters -> ....

You can also see that gtk_enumerate_printers was already called earlier.
No idea why you get the EntryPointNotFoundException, but I suspect it to
be related  to the recursion issue. This is for sure not a problem in Gtk#.


Christian


_______________________________________________
Gtk-sharp-list maillist  -  Gtk-sharp-list@...
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

Re: GtkPrint on Windows

by Milton Pividori-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Christian, thank you for your reply. I tried with a simpler example,
but I got the same exception:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.EntryPointNotFoundException: gtk_enumerate_printers
  at (wrapper managed-to-native) Gtk.Printer:gtk_enumerate_printers (GtkSharp.Pr interFuncNative,intptr,GLib.DestroyNotify,bool)
  at Gtk.Printer.EnumeratePrinters (Gtk.PrinterFunc func, Boolean wait) [0x00000 ]
  at MainWindow.OnButtonClicked (System.Object sender, System.EventArgs e) [0x00 000]
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (ob ject,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invoke Attr, 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 invoke Attr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000]
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] par ameters) [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 OtraPruebaGtkPrint.MainClass.Main(System.String[] args)

It doesn't seem to be a recursion issue. The same code works on Linux,
but fails on Windows. This is the code I wrote:

<code>
...
public bool WritePrinterName(Gtk.Printer printer)
{
        Console.WriteLine(printer.Name);
        return false;
}

protected virtual void OnEnumeratePrinters (object sender, System.EventArgs e)
{
        Gtk.Printer.EnumeratePrinters(this.WritePrinterName, false);
}
...
</code>

You can download the complete solution from here:

http://svn.miltonpividori.com.ar/GtkPrintTest.tar.gz

I tried changing the bool parameter in Gtk.Printer.EnumeratePrinters
function, but it doesn't work either.

Any ideas?

El dom, 06-09-2009 a las 12:02 +0200, Christian Hoff escribió:

> Looking into the stack trace, the problem seems that your code is
> infinetly recurse:
>
> SolapaServicioImpresion..ctor -> calls EnumeratePrinters -> calls
> solapaServicioImpresion..ctor-> calls EnumeratePrinters -> ....
>
> You can also see that gtk_enumerate_printers was already called
> earlier.
> No idea why you get the EntryPointNotFoundException, but I suspect it
> to
> be related  to the recursion issue. This is for sure not a problem in
> Gtk#.
>
>
> Christian
--
Milton Pividori
Blog: http://www.miltonpividori.com.ar
Jabber ID: miltondp@...
GnuPG Public Key: gpg --keyserver subkeys.pgp.net --recv-key 0x663C185C

_______________________________________________
Gtk-sharp-list maillist  -  Gtk-sharp-list@...
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

Re: GtkPrint on Windows

by Christian Hoff :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Milton Pividori wrote:

> Hi Christian, thank you for your reply. I tried with a simpler example,
> but I got the same exception:
>
> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.EntryPointNotFoundException: gtk_enumerate_printers
>   at (wrapper managed-to-native) Gtk.Printer:gtk_enumerate_printers (GtkSharp.Pr interFuncNative,intptr,GLib.DestroyNotify,bool)
>
> It doesn't seem to be a recursion issue. The same code works on Linux,
> but fails on Windows. This is the code I wrote:
>
> <code>
> ...
> public bool WritePrinterName(Gtk.Printer printer)
> {
> Console.WriteLine(printer.Name);
> return false;
> }
>
> protected virtual void OnEnumeratePrinters (object sender, System.EventArgs e)
> {
> Gtk.Printer.EnumeratePrinters(this.WritePrinterName, false);
> }
> ...
> </code>
>
> I tried changing the bool parameter in Gtk.Printer.EnumeratePrinters
> function, but it doesn't work either.
>
> Any ideas?
>  
None so far. The function should also be available on Windows and the
code on the Gtk# side seems correct.

Could you file a bug report (www.mono-project.com/Bugs)?


Christian
_______________________________________________
Gtk-sharp-list maillist  -  Gtk-sharp-list@...
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

Re: GtkPrint on Windows

by Milton Pividori-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Done:

https://bugzilla.novell.com/show_bug.cgi?id=537099

Thank you for your help.

El dom, 06-09-2009 a las 20:45 +0200, Christian Hoff escribió:
> Could you file a bug report (www.mono-project.com/Bugs)?
--
Milton Pividori
Blog: http://www.miltonpividori.com.ar
Jabber ID: miltondp@...
GnuPG Public Key: gpg --keyserver subkeys.pgp.net --recv-key 0x663C185C

_______________________________________________
Gtk-sharp-list maillist  -  Gtk-sharp-list@...
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list