473,779 Members | 2,016 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Long Running Operations Windows Forms

86 New Member
So I'm working on a Windows Forms for VB.NET in VS 2005 that is highly computational. It gets a ton of data from a database and eventually spits out a report based on the data. Because of the time it takes to run, when I debug I get the following message:

"The CLR has been unable to transition from COM context 0x1a01b0 to COM context 0x1a0320 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultip leHandles) and routinely pump messages during long running operations."

Any advice on how to handle this situation? I've tried to make my code as efficient as possible, so I'm going to have to deal with these long periods of computation.

Thanks.
Feb 20 '07 #1
6 2070
kenobewan
4,871 Recognized Expert Specialist
IMO - web designers are smarter with handling large files than we web/ windows developers are with data. What do I mean? They think about what they can preload to the browser and what can happen later.

Can't comment on your particular case Enreil, but some developers use SQL queries that are too general and try to manage all of the data at once instead of 'packets'. I guess my suggestion is that it is great that you have optimized your code - have you optimized your queries? Database design and optimized queries are important for the transition from medium to large applications.
My two cents worth...

Of course if you have already got a good database design and well structured queries, then you may want to look at managing your threads.
Feb 21 '07 #2
enreil
86 New Member
Thanks for your thoughts. My SQL queries are pretty basic select statements, so I don't know that there's a whole lot of optimization I can do in that regard. The real holdup in this project is the DB access time. The DB is located several time zones away and it just takes a long time to go there and bring the data back. I'm working with tens of thousands of rows of data, so I try to mitigate the overhead caused by the long DB trips by grabbing all of the data I need in one trip, stashing it in memory, and thenselecting what I need from there. I didn't research this tactic, but it seemed logical. The alternative is to make multiple trips to get the specific data I need, so while my SQL queries would runs faster by pulling less data, the time to get there and back makes that an undesirable approach.

Anyways, I'll look into better thread management and see where that takes me. Appreciate the feedback.
Feb 21 '07 #3
kenobewan
4,871 Recognized Expert Specialist
Any progress using thread management?
Feb 23 '07 #4
enreil
86 New Member
Thanks for asking. Yes, improving thread management gets rid of the error - I just added the line

System.Threadin g.Thread.Curren tThread.Join(1)

at appropriate places in my code. It'll do for now. Looking back at my code, I think there is still room to make my code more efficient, but right now I just need the app to do its job. Thanks for your assistance!

Any progress using thread management?
Feb 23 '07 #5
AricC
1,892 Recognized Expert Top Contributor
Thanks for your thoughts. My SQL queries are pretty basic select statements, so I don't know that there's a whole lot of optimization I can do in that regard. The real holdup in this project is the DB access time. The DB is located several time zones away and it just takes a long time to go there and bring the data back. I'm working with tens of thousands of rows of data, so I try to mitigate the overhead caused by the long DB trips by grabbing all of the data I need in one trip, stashing it in memory, and thenselecting what I need from there. I didn't research this tactic, but it seemed logical. The alternative is to make multiple trips to get the specific data I need, so while my SQL queries would runs faster by pulling less data, the time to get there and back makes that an undesirable approach.

Anyways, I'll look into better thread management and see where that takes me. Appreciate the feedback.
What kind of connection do you have between the two sites?
Feb 23 '07 #6
enreil
86 New Member
Between my app and the DB? The DB is Oracle, and I'm just using a basic Oracle connection string with the Datasource, username, and password. Is that what you're getting at?

What kind of connection do you have between the two sites?
Feb 23 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

16
2891
by: Justin Lazanowski | last post by:
Cross posting this question on the recommendation of an I have a .NET application that I am developing in C# I am loading information in from a dataset, and then pushing the dataset to a grid, or other controls depending on the particular form. This application is setup with one MDI parent calling MDI children with the exception of one Modal form (the report viewer). When I run the application and run one of the screens that pulls...
9
7135
by: rsine | last post by:
I have developed a program that sends a command through the serial port to our business system and then reads from the buffer looking for a number. Everything worked great on my WinXP system, but when I tried the program on the Win98 system it will be running on, I get the following error: Cast from string "2076719" to type 'Long' is not valid I am not sure why I only get this error on the Win98 system or how to go about correcting...
2
2217
by: Jeff | last post by:
I'm getting an Object Reference error before I even run my app, and I'm not sure where to look to find the cause. I'd appreciate your help. When I open my Windows Application project, the following Microsoft Development Environment error message displays: "Object reference not set to an instance of an object." Then when I access the design view of one of my forms, the controls on
0
2210
by: Slawomir Nasiadka | last post by:
Hi, I'am new to this group so I would like to say "Hello" everyone and here is my problem: I'm writing a simple application (code is at the end of this message) witch would list all mails from a directory from Outlook Express. I have: - OE 6.0 - .NET Framework 1.1 - interface definition language for OE 6.0 - msoeapi.idl
4
4183
by: tshad | last post by:
What would be a good way to check programmatically whether a service was running? We have a service that dies periodically and I need to check to see if this service is running. I know how to check to see if the status is in stopped or running mode. But that doesn't tell me if it is actually running. I need to know this so that if it happens I can programmatically start the same service on another machine.
9
3270
by: esakal | last post by:
Hello, I'm programming an application based on CAB infrastructure in the client side (c# .net 2005) Since my application must be sequencally, i wrote all the code in the UI thread. my problem occurs when i try to show a progress bar. The screen freezes. I know i'm not the first one to ask about it. but i'm looking
4
3268
by: Jono | last post by:
Hi Everyone, As it says in the title, I'm looking for a way to display a page while long running operations are performed on the server. Ideally, I'd like some way to push the current request onto some stack, where it would continue to be processed asynchronously (most importantly preserving things like view state, form post data, etc). In the interim, while the main request is processed, a friendly page will be displayed to the user....
3
3548
by: =?Utf-8?B?QWxleGFuZGVyIFd5a2Vs?= | last post by:
My application is taking way too long to build. It use to never take so long. I change only line and I think it recompiles all the classes in the assembly because it hangs forever. Here is the compiler line from the output window during complication: Target CoreCompile: C:\WINDOWS\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702 /platform:x86 /errorreport:prompt /warn:4 /define:DEBUG;TRACE /main:AutoDeveloper.Program...
2
1799
by: =?Utf-8?B?d2R1ZGVr?= | last post by:
I have a website using windows integrated security, with anonymous access turned off. The site is used to query orders from a database and when the search takes a long time, a windows login box appears. Regardless of what login the user enters into this, it does not accept it and the user is locked out of the system. Our network team and myself have been unable to find out why this is occurring, has anyone else had a similiar problem?...
0
9636
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9474
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
10306
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10074
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,...
0
9930
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8961
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5373
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...
1
4037
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
3
2869
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.