Page 1 of 1
System.StackOverflowException
Posted: Fri Nov 18, 2011 4:01 am
by PQSIK
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
Re: System.StackOverflowException
Posted: Fri Nov 18, 2011 1:27 pm
by Loïc
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
Re: System.StackOverflowException
Posted: Fri Nov 18, 2011 4:26 pm
by Loïc
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
Re: System.StackOverflowException
Posted: Fri Nov 18, 2011 6:26 pm
by PQSIK
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
Re: System.StackOverflowException
Posted: Fri Nov 18, 2011 7:45 pm
by Loïc
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
Re: System.StackOverflowException
Posted: Sat Nov 19, 2011 5:32 pm
by PQSIK
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"
Re: System.StackOverflowException
Posted: Sat Nov 19, 2011 6:06 pm
by Loïc
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 ??
Re: System.StackOverflowException
Posted: Sun Nov 20, 2011 6:10 pm
by PQSIK
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
Re: System.StackOverflowException
Posted: Sun Nov 20, 2011 6:21 pm
by Loïc
Hi,
Please follow these instructions to generate a LOG:
viewtopic.php?t=1486
Kind regards,
Loïc
Re: System.StackOverflowException
Posted: Sun Nov 20, 2011 11:59 pm
by PQSIK
Hi,
I followed the instructions and create a new support case.
Thanks
PQSIK