473,775 Members | 2,345 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Weird behavior, Program bombs out unless Application.DoE vents() or GC.Collect is called.

I'm creating a .net db provider and I came across a weird problem w/ my data
reader.
The .net provider was created in managed c++ becuase the db api is also c++.
I'm calling the code from a c# project. It shouldn't make a difference but I
did have to do
http://support.microsoft.com/default.aspx?scid=kb;[LN];814472&product =vcNET
to get my c++ project to compile properly. Anyways, as test i did 'select *
from items' using both an ole db dataadapter and my custom db provider, but
targeting the same database. The items table has about 220 fields and 3,222
records. The oledb adapter filled a dataset with no problem. My data adapter
bombed out when retrieving field 10 of record 563.

The problem occurs in my custom data adpater which is used by the customer
data adapter. Everytime MyCustomDataRea der.Read() is called, (in this case)
it initializes an Array of type Object with a length of 220. It then does a
foreach and fills in each cell with the data stored in the record.

Now here's where it gets funky. If I call GC.Collect and/or
System.Windows. Forms.Applicati on.DoEvents() w/ each iteration, it will
retrieve all the records w/ no problems. Doing neither causes the
application to exit and no exception is thrown either. The debug output
shows the exit code as 0. Does anyone have any clues as to why?

The fact that it doesn't throw an exeption is what bothers me the most.
Nov 16 '05 #1
3 1868
Other times I've seen the app just terminate without message is when there
was a (complicated) stack overflow in a routine that allocates a lot of
memory on the stack... not sure why exactly, but I guess the CLR doesn't
have enough stack space to even run the code that shows the exception error.

--
John Wood
EMail: first name, dot, second name at priorganize.com
"Hasani" <HJ****@hotmail .c0m> wrote in message
news:kN******** ************@co mcast.com...
I'm creating a .net db provider and I came across a weird problem w/ my data reader.
The .net provider was created in managed c++ becuase the db api is also c++. I'm calling the code from a c# project. It shouldn't make a difference but I did have to do
http://support.microsoft.com/default.aspx?scid=kb;[LN];814472&product =vcNET to get my c++ project to compile properly. Anyways, as test i did 'select * from items' using both an ole db dataadapter and my custom db provider, but targeting the same database. The items table has about 220 fields and 3,222 records. The oledb adapter filled a dataset with no problem. My data adapter bombed out when retrieving field 10 of record 563.

The problem occurs in my custom data adpater which is used by the customer
data adapter. Everytime MyCustomDataRea der.Read() is called, (in this case) it initializes an Array of type Object with a length of 220. It then does a foreach and fills in each cell with the data stored in the record.

Now here's where it gets funky. If I call GC.Collect and/or
System.Windows. Forms.Applicati on.DoEvents() w/ each iteration, it will
retrieve all the records w/ no problems. Doing neither causes the
application to exit and no exception is thrown either. The debug output
shows the exit code as 0. Does anyone have any clues as to why?

The fact that it doesn't throw an exeption is what bothers me the most.

Nov 16 '05 #2
I believe this is happening in debug mode only, I made some code changes to
reduce memory usage. I didn't try it in release mode then. But in release
mode, it runs properly. The same problem still occurs in debug mode though,
I'll try to find a larger database table to do further testing.

"Hasani" <HJ****@hotmail .c0m> wrote in message
news:kN******** ************@co mcast.com...
I'm creating a .net db provider and I came across a weird problem w/ my data reader.
The .net provider was created in managed c++ becuase the db api is also c++. I'm calling the code from a c# project. It shouldn't make a difference but I did have to do
http://support.microsoft.com/default.aspx?scid=kb;[LN];814472&product =vcNET to get my c++ project to compile properly. Anyways, as test i did 'select * from items' using both an ole db dataadapter and my custom db provider, but targeting the same database. The items table has about 220 fields and 3,222 records. The oledb adapter filled a dataset with no problem. My data adapter bombed out when retrieving field 10 of record 563.

The problem occurs in my custom data adpater which is used by the customer
data adapter. Everytime MyCustomDataRea der.Read() is called, (in this case) it initializes an Array of type Object with a length of 220. It then does a foreach and fills in each cell with the data stored in the record.

Now here's where it gets funky. If I call GC.Collect and/or
System.Windows. Forms.Applicati on.DoEvents() w/ each iteration, it will
retrieve all the records w/ no problems. Doing neither causes the
application to exit and no exception is thrown either. The debug output
shows the exit code as 0. Does anyone have any clues as to why?

The fact that it doesn't throw an exeption is what bothers me the most.

Nov 16 '05 #3
Ok, I think I fixed the problem. It had something to do with the Linker
settings in the c++ project. I get a warning when I compile now, but it
works!
"John Wood" <sp**@isannoyin g.com> wrote in message
news:eQ******** ******@TK2MSFTN GP09.phx.gbl...
Other times I've seen the app just terminate without message is when there
was a (complicated) stack overflow in a routine that allocates a lot of
memory on the stack... not sure why exactly, but I guess the CLR doesn't
have enough stack space to even run the code that shows the exception error.
--
John Wood
EMail: first name, dot, second name at priorganize.com
"Hasani" <HJ****@hotmail .c0m> wrote in message
news:kN******** ************@co mcast.com...
I'm creating a .net db provider and I came across a weird problem w/ my data
reader.
The .net provider was created in managed c++ becuase the db api is also

c++.
I'm calling the code from a c# project. It shouldn't make a difference but I
did have to do

http://support.microsoft.com/default.aspx?scid=kb;[LN];814472&product =vcNET to get my c++ project to compile properly. Anyways, as test i did 'select *
from items' using both an ole db dataadapter and my custom db provider, but
targeting the same database. The items table has about 220 fields and

3,222
records. The oledb adapter filled a dataset with no problem. My data

adapter
bombed out when retrieving field 10 of record 563.

The problem occurs in my custom data adpater which is used by the

customer data adapter. Everytime MyCustomDataRea der.Read() is called, (in this

case)
it initializes an Array of type Object with a length of 220. It then

does a
foreach and fills in each cell with the data stored in the record.

Now here's where it gets funky. If I call GC.Collect and/or
System.Windows. Forms.Applicati on.DoEvents() w/ each iteration, it will
retrieve all the records w/ no problems. Doing neither causes the
application to exit and no exception is thrown either. The debug output
shows the exit code as 0. Does anyone have any clues as to why?

The fact that it doesn't throw an exeption is what bothers me the most.


Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

24
3292
by: bazad | last post by:
Hi, I'd like to understand consequences of Application.DoEvents call. Does it create a new thread? Thank you
6
609
by: foldface | last post by:
Hi I am doing drag and drop between controls (listview and treeview) using mouse_event. What I am after is a book/resource to explain the behaviour below. If I do the various Win32 api calls and call Application.Run, it works. I can see dragging and dropping on the screen. If I do this:
6
4300
by: Ollie Riches | last post by:
I understand the use of Application.DoEvents() to process all outstanding messages on the message queue in a winforms application if you have long running process on the UI thread. But can anyone explain to me why I need to call DoEvents when I am using a COM component that calls back to into the ..Net application? - If I don't call DoEvents after receiving a callback then sometimes no more messages are pumped, it appears that the message...
8
6508
by: TrtnJohn | last post by:
I have an application where I would like to block waiting on an asynchronous event and still process messages. I can implement a hard loop to block such as: Do While StillWaiting Application.DoEvents Loop In this case the asynchronous thread can just set StillWaiting=False when complete.
13
10105
by: Amjad | last post by:
Hi, Is there an equivalent to the "Application.Doevents" method in modules or Windows services? I want to make a Windows service that calls a DLL. The DLL would have all my functions and it would be doing all the job, but some of the functions that I'm using require calling something like "Application.Doevents" and I can't use this because the DLL module is not an application.
2
1533
by: joeforbroke | last post by:
Background: I am helping someone debug a problem with their form that I have traced to a strange interaction between a click event handler and Application.DoEvents(). I'm trying to talk him into using mutithreading. Problem in its essence: create a simple Form with 2 buttons and a label. button1 starts a long-running counting process, button 2 stops the counting process. The
5
4579
by: james.jdunne | last post by:
System.ArgumentException: Item has already been added. Key in dictionary: "-1" Key being added: "-1" at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add) at System.Collections.Hashtable.Add(Object key, Object value) at System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FRegisterComponent(IMsoComponent component, MSOCRINFOSTRUCT pcrinfo, Int32& dwComponentID) at...
8
381
by: Jeremy S. | last post by:
Application.DoEvents(); Why would I ever want to do that? When is it (1) required, or (2) a "good idea" or (3) a "bad idea" Thanks.
0
1067
by: Kristijan Marin | last post by:
Hi, I have experianced same wierd behavior by one of my customers ..... Here is the thing .... We have the application for newspaper article management. so adding end editing etc .... After a while my customer started to complain that they have duplicate articles in there database ....
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10046
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7463
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5358
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4014
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3611
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2852
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.