System.StackOverflowException

Discussions about TWAIN & WIA scanning in GdPicture.NET using GdPictureImaging.
Post Reply
PQSIK
Posts: 50
Joined: Wed Oct 21, 2009 7:26 pm

System.StackOverflowException

Post by PQSIK » Fri Nov 18, 2011 4:01 am

Hi,

I was testing gdpictures in a WPF project to list the scanners and could not get past the form load.
I keep getting the error below

"An unhandled exception of type 'System.StackOverflowException' occurred in PresentationFramework.dll"

Code: Select all

Private Sub Main_Loaded(sender As Object, e As System.Windows.RoutedEventArgs) Handles Me.Loaded
        Dim gdp As New GdPicture.GdPictureImaging
        gdp.SetLicenseNumberUpgrade(xxxx,xxxx)
        
        For i As Integer = 1 To gdp.TwainGetSourceCount(IntPtr.Zero)
            ListBox1.Items.Add(gdp.TwainGetSourceName(IntPtr.Zero, i))
        Next
        gdp.Dispose()
        gdp = Nothing

End Sub

Also tried

Private Sub Main_Loaded(sender As Object, e As System.Windows.RoutedEventArgs) Handles Me.Loaded
        Dim gdp As New GdPicture.GdPictureImaging
        gdp.SetLicenseNumberUpgrade(xxxx,xxxx)
        
        For i As Integer = 1 To gdp.TwainGetSourceCount(IntPtr.Zero)
           
        Next
        gdp.Dispose()
        gdp = Nothing

End Sub
I have the correct dll v4.0.30319
Can gdpictures work in WPF?
Has anyone had the same problem?

Thanks

PQSI

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: System.StackOverflowException

Post by Loïc » Fri Nov 18, 2011 1:27 pm

Hello,

Could you provide a sample project reproducing the problem ?

If you can't attach here you can sent it through https://www.gdpicture.com/support/getting-support-from-our-team

Kind regards,

Loïc

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: System.StackOverflowException

Post by Loïc » Fri Nov 18, 2011 4:26 pm

I've cross checked from my side. All is running fine with TWAIN scanning & WPF.
I've added a TWAIN scanning buton to the demo attached in this topic: viewtopic.php?t=3187

Kind regards,

Loïc

PQSIK
Posts: 50
Joined: Wed Oct 21, 2009 7:26 pm

Re: System.StackOverflowException

Post by PQSIK » Fri Nov 18, 2011 6:26 pm

Thanks for the quick reply,

I tried you code and it ran fine.
I'm using .net 4.0 and when I change the project you project to use .net 4.0 I get the error

Can you test your project in .net 4.0 and and code, I'm sure you will get the same error.

Code: Select all

Dim oGdPictureImaging As New GdPicture.GdPictureImaging

        ComboBox1.Items.Add(oGdPictureImaging.TwainGetDefaultSourceName(IntPtr.Zero))

        For i As Integer = 1 To oGdPictureImaging.TwainGetSourceCount(IntPtr.Zero)
        ComboBox1.Items.Add(oGdPictureImaging.TwainGetSourceName(IntPtr.Zero, i))
        Next
Thanks

PQSIK

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: System.StackOverflowException

Post by Loïc » Fri Nov 18, 2011 7:45 pm

Hi,

The app also works fin in framework 4.0 from my side. I've tested with 5 different scanners.

Could you attach the modified version you are using ?

Loïc

PQSIK
Posts: 50
Joined: Wed Oct 21, 2009 7:26 pm

Re: System.StackOverflowException

Post by PQSIK » Sat Nov 19, 2011 5:32 pm

Hi,

I have attached the project with the modified code.

Test steps 1.

1. Click the load the default scanner button

2. Click the text box that has the default scanner name. "you should get the error then"

stop and run again then

Test step 2.

1. Click the load the default scanner button

2. Click the "Using GdPictureImaging Class - Load image from file and save as c:\test.jpg" button. "don't load image just close it"

Thanks

PQSIK

3. Click the text box that has the default scanner name. "you should not get the error"
Attachments
Twain Scan.zip
I using Visual Studio 2010
(97.28 KiB) Downloaded 432 times

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: System.StackOverflowException

Post by Loïc » Sat Nov 19, 2011 6:06 pm

All is running fine for me.
Also I don't understand at all the interest of the test you provided. Why clicking on a textbox that raises no event ??

PQSIK
Posts: 50
Joined: Wed Oct 21, 2009 7:26 pm

Re: System.StackOverflowException

Post by PQSIK » Sun Nov 20, 2011 6:10 pm

Hi again,

The test is showing you the steps that gave me the error.

I know the text box has on event in the code, I used the text box because it was also giving me the error as a combo box when clicked

Code: Select all

ComboBox1.Items.Add(oGdPictureImaging.TwainGetDefaultSourceName(IntPtr.Zero))
TextBox1.Text = oGdPictureImaging.TwainGetDefaultSourceName(IntPtr.Zero)

Code: Select all

Private Sub Window1_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded
       Dim str As String = oGdPictureImaging.TwainGetDefaultSourceName(IntPtr.Zero)
        oGdPictureImaging.Dispose()
        oGdPictureImaging = Nothing
    End Sub
All above tests give me the error

Below works.

Code: Select all

ComboBox1.Items.Add("Test Text")
TextBox1.Text = "This also works")
I'm at a loss as to why
Your welcome to join a Gotomeeting session and see for yourself. You can email me if you want to join and I will send you a session id.

Thanks

PQSIK

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: System.StackOverflowException

Post by Loïc » Sun Nov 20, 2011 6:21 pm

Hi,

Please follow these instructions to generate a LOG: viewtopic.php?t=1486

Kind regards,

Loïc

PQSIK
Posts: 50
Joined: Wed Oct 21, 2009 7:26 pm

Re: System.StackOverflowException

Post by PQSIK » Sun Nov 20, 2011 11:59 pm

Hi,

I followed the instructions and create a new support case.

Thanks

PQSIK

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests