Results 1 to 33 of 33

Thread: VB app takes long time to load

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2006
    Posts
    81

    VB app takes long time to load

    I have a very small VB application that is just a calculator. I run it from the exe in the bin folder. My issue is, that it takes about 30-40 seconds for the form to open. If I close it and then run it again, it will only take 2-3 seconds. But if I try again in a few hours, it will again take 30-40 seconds. All that runs at form load is loading the form in the screenshot below. No other actions are performed at load time that would cause the delay.

    The truth is, I have other small applications that have this same issue. It's been like this for years, I'm just asking about it now because it has always been annoying and I'd like to get to the bottom of it.

    Any idea how to solve this?

    Name:  Percent_Calculator_qOtPXQJugZ.jpg
Views: 298
Size:  38.6 KB

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    106,548

    Re: VB app takes long time to load

    It sounds like an issue with your system rather than this application. Try the same project/application on a different machine and see whether it behaves the same. If it doesn't then obviously it's your system.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Sep 2006
    Posts
    81

    Re: VB app takes long time to load

    Obviously, that was my first thought, but all other software on my computer (not developed by me) loads super fast; even Photoshop loads faster than 30 seconds and I'm sure a lot more goes on in the background when photoshop loads than my calculator. So I don't think it's my system.

  4. #4
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    106,548

    Re: VB app takes long time to load

    Quote Originally Posted by ZviT View Post
    So I don't think it's my system.
    What you think isn't really relevant. Find out what actually is the case, so we don't waste our time trying to find another cause that doesn't exist.

  5. #5
    Member
    Join Date
    Jun 2017
    Posts
    41

    Re: VB app takes long time to load

    Turn off your anti virus software, if you have any running on your machine

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Sep 2006
    Posts
    81

    Re: VB app takes long time to load

    Quote Originally Posted by BlackRiver1987 View Post
    Turn off your anti virus software, if you have any running on your machine
    I use the built-in Windows Defender. I wouldn't want to turn it off every time I run one of my applications.
    I am going to take jmcilhinney's suggestion and find a friend to try it on his computer.

  7. #7
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    106,548

    Re: VB app takes long time to load

    Quote Originally Posted by ZviT View Post
    I am going to take jmcilhinney's suggestion and find a friend to try it on his computer.
    If you can't find anyone to do it for you, delete all the obj and bin folders from your solution, zip it up and attach it here. Someone here may well be willing to test it for you.

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Sep 2006
    Posts
    81

    Re: VB app takes long time to load

    Quote Originally Posted by jmcilhinney View Post
    If you can't find anyone to do it for you, delete all the obj and bin folders from your solution, zip it up and attach it here. Someone here may well be willing to test it for you.
    That would be a big help. I'm attaching it here.
    But don't test by running it within Visual Studio because then it always opens in seconds, even by me.
    Attached Files Attached Files

  9. #9
    Member
    Join Date
    Jun 2017
    Posts
    41

    Re: VB app takes long time to load

    Worked fine for me running the EXE from the bin folder

  10. #10
    Fanatic Member
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    748

    Re: VB app takes long time to load

    You DO need to do things such as turning off Windows Defender if you want to find out why it takes a while to load. If it is the same then you know it is not Defender and you can turn it on again. If it runs faster then you know why and you can turn windows Defender back on again.

    Simple steps to diagnose the issue.

    First things first, tell us your machine configuration, CPU, RAM, boot drive hardware, hardware where the affected binary resides plus usage of same in % when the slowdown occurs.

    Which software packages are running simultaneously, using task manager what load does your program put on the system?

    Basic information like that is required.

    If you went to a doctor and told him you were ill but would not let him examine you? - that's where we are at the moment.

  11. #11
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    4,657

    Re: VB app takes long time to load

    Yeah, it triggered Windows Defender on my machine. But after creating the bin folders, when I ran the exe it popped up instantly.

  12. #12

    Thread Starter
    Lively Member
    Join Date
    Sep 2006
    Posts
    81

    Re: VB app takes long time to load

    Quote Originally Posted by wes4dbt View Post
    Yeah, it triggered Windows Defender on my machine. But after creating the bin folders, when I ran the exe it popped up instantly.
    As I mentioned, if you run it a second time, also by me it would open immediately. If a few hours went by since you tested it, try running the exe now and see if it runs immediately.

    Is this normal that a VB project would trigger Windows Defender? Does this happen with your projects as well?

    UPDATE: I noticed that years ago I already added an exception to Windows Defender so that it shouldn't look in the folder that has my VB projects\applications. Can this be the reason it's causing a delay at startup? Windows Defender takes time to decide to "skip" this folder? Is it normal that Windows Defender would have issues running our personal VB projects?

  13. #13

    Thread Starter
    Lively Member
    Join Date
    Sep 2006
    Posts
    81

    Re: VB app takes long time to load

    Quote Originally Posted by yereverluvinuncleber View Post
    You DO need to do things such as turning off Windows Defender if you want to find out why it takes a while to load. If it is the same then you know it is not Defender and you can turn it on again. If it runs faster then you know why and you can turn windows Defender back on again.
    As I mentioned, The project folder is added as an exception in Windows Defender. Will try to turn it off in a few hours because I just ran the app so now it will run fine and test would be inaccurate.

    Quote Originally Posted by yereverluvinuncleber View Post
    First things first, tell us your machine configuration, CPU, RAM, boot drive hardware, hardware where the affected binary resides plus usage of same in % when the slowdown occurs.
    CPU: i7-3770K 3.90GHz
    RAM: 32.0 GB
    BOOT DRIVE: Samsung SSD 860 EVO 1TB
    BINARY DRIVE: Internal WD BLUE 4TB SATA
    TOTAL CPU % at app run: 9%. Out of which the app itself is only using 4% of that.

    Quote Originally Posted by yereverluvinuncleber View Post
    Which software packages are running simultaneously, using task manager what load does your program put on the system
    Lots of programs are running simultaneously, but are very well monitored by me and nothing extra is loaded. As I mentioned, even Photoshop opens faster so it's not a load issue.

  14. #14
    Fanatic Member
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    748

    Re: VB app takes long time to load

    But we need to know what those programs are... once again you aren't telling us all the picture. Ensure you are running the bare minimum of applications so that you avoid any potential room for conflicts between programs.

    Look, simply try to run the program on as basic a config as possible. Nothing else running, in this way you are doing your own diagnosis, removing possibly affecting elements. Then if the problem goes away then you can add each back in one by one until you find the culprit. If it changes nothing then it excludes them.

    FYI Photoshop on my old system starts in less than 8 seconds but Photoshop has many versions, you did not supply yours so we cannot compare, see what I mean?

    What are the speeds of your drives? Do you have any 'interesting' additional tools running such as malwarebytes or project lasso?

  15. #15
    Fanatic Member
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    748

    Re: VB app takes long time to load

    In addition look at the power saving features of your drive and look at AAM/APM control, crystaldiskinfo is a useful tool. I am going to guess, however that when you turn defender off things may improve. IF not then keep digging.
    Last edited by yereverluvinuncleber; Mar 5th, 2021 at 06:06 AM.

  16. #16
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    4,657

    Re: VB app takes long time to load

    As I mentioned, if you run it a second time, also by me it would open immediately. If a few hours went by since you tested it, try running the exe now and see if it runs immediately.
    Just ran your exe. Took about three seconds to display. No Windows Defender triggered this time. I also had completely rebooted my system today.

    Yeah, it really is hard to diagnose your machine, Windows can be configured to many ways and only you know the machines history. That's why jmc had suggested trying your program on another machine first. But the problem seems to be on your machine. I am curious, if you shut down your machine and then restart it , does it still take 3hrs before the programs loads slow?

  17. #17

    Thread Starter
    Lively Member
    Join Date
    Sep 2006
    Posts
    81

    Re: VB app takes long time to load

    Ok, guys, thanks for the help. I understand from your replies and tests that it's something on my system. I was hoping that it's something know about Visual Studio that can be solved within the solution but I guess not.

    I understand the logic about other running software, HDD speeds, etc, however, if any of these were the issue, they would technically affect other software (not mine), but they don't. Photoshop was just an example but I use many programs for all sorts of things, including editing and rendering DLSR video, with no speed issue. My system is carefully monitored periodically (manually) with various software and I don't have any issues with any other aspect of the system other than my own VS programs.

    So yes, even if the issue would not exist say in safe mode (which I haven't tried), which would hint that some running process is causing this, it wouldn't explain why it's causing this only on my own, small VS programs.

    I've been living with this for many years so if it's not a simple solution in VS, I think I'll let it go for now.

    Thank you all again for your help.

  18. #18
    Fanatic Member
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    748

    Re: VB app takes long time to load

    Actually chap, not quite how it works. IF you wake people up and start to engage their busy brains in an effort to help you, you need to do at least two things:

    a. In the first place, supply the information about your config so that they can help you...

    and once you have the help engaged -

    b. Do the right thing and keep them posted about the steps you take to resolve the problem and let them know the final solution, closing off the thread when that solution is found. Once you have asked for help it is the "done thing" not to leave the kind-hearted in the lurch. This thread will then act as a source of help for anyone with a similar problem. Please ensure you update.

  19. #19

    Thread Starter
    Lively Member
    Join Date
    Sep 2006
    Posts
    81

    Re: VB app takes long time to load

    I would have definitely updated. Anyway, here you can download the reports of my system. Should have all that one would need. (forum wouldn't upload to here) https://mega.nz/file/wZxDzIYJ#2EG6eM...JGXuJTUQmebagU

  20. #20
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    33,285

    Re: VB app takes long time to load

    Quote Originally Posted by ZviT View Post
    So yes, even if the issue would not exist say in safe mode (which I haven't tried), which would hint that some running process is causing this, it wouldn't explain why it's causing this only on my own, small VS programs.
    Actually, it could have been very telling. There would have been a couple of things to look at. Once you eliminate all of the other external variables, then we could have started looking at other things. Honestly the first thing that jumped to my mind was the JIT kicking in. First time it needs to run to build the app to run it. It runs faster the second time because it's been cached. But later runs you claim seem to be taking forever as well... that could be indicative of something doing some cleanup that it shouldn't be doing. So you havve two things working against you. The JIT, and what ever is doing disk cleanup. But for what ever reason, you're not willing to take the time to run a white room and take a look. So like the owl in the Tootsie pop commercial, we may never know. You can't compare start up times of one app to another unless they are bulit the same. Last I checked Photoshop was not a .NET app, so it's startup is completely different. That's a gazelle. We're talking about a thoroughbred horse here. It's not even an apple to apple comparison.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  21. #21
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Pointless Forest 38.517,-92.023
    Posts
    9,363

    Re: VB app takes long time to load

    Quote Originally Posted by ZviT View Post
    I would have definitely updated. Anyway, here you can download the reports of my system. Should have all that one would need. (forum wouldn't upload to here) https://mega.nz/file/wZxDzIYJ#2EG6eM...JGXuJTUQmebagU
    Have you looked at your events for any obvious errors?
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  22. #22
    Frenzied Member Poppa Mintin's Avatar
    Join Date
    Mar 2009
    Location
    Skunthorpe, North Lincolnshire, England.
    Posts
    2,030

    Re: VB app takes long time to load

    I notice that you're concerned about running your software with Windows Defender turned off.
    Understandable, but if you turn off your connection to the internet whilst you do that... From where can anything malicious come?


    Poppa
    Along with the sunshine there has to be a little rain sometime.

  23. #23

    Thread Starter
    Lively Member
    Join Date
    Sep 2006
    Posts
    81

    Re: VB app takes long time to load

    Techgnome:
    Yes, I knew that it loads fast the second time because it’s getting cashed somewhere. I assumed that it was cached in RAM and after some time of using other software on the computer, that RAM would get swapped with other stuff.

    Dbasnett:
    Yes, I’ve checked; no errors in events.

    Poppa Mintin:
    I will try without WD also.

    UPDATE:
    I ran “Process Monitor” while running the calculator and it seems that all of my system fonts have a play at load time, which even have more processes going on than the opening of the program itself (attached screenshots). I have over 2,500 installed fonts which may or may not be the culprit. Although my C drive is an SSD, my computer is almost 7 years old and not the most modern of systems in 2021.
    I have an image of a clean Windows installation with minimal software and default fonts which I created with “Macrium Reflect” and can run it on a virtual machine to test my app loading time without so many fonts. I will try that too.
    Attached Images Attached Images   

  24. #24
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    5,882

    Re: VB app takes long time to load

    6-7 Years ago I was working in a company that was selling it's own Framework based on Visual Studio. We had lot of performance issues and most of them I could find out using Visual Studio Performance Analysis.
    Having said that, I don't remember squat of how I was using it but if there is someone here that used it recently he/she might be able to give you some advice.
    So what you can do is go to Analyze --> Start Performance analysis. Run the code that bother you and let us know your results.
    If you haven't used it then I suppose it's difficult to find out what is going on but , again, someone might help you and also, if you are lucky, you might be able to find the functions that are doing most of the work in the summary.
    .

  25. #25

    Thread Starter
    Lively Member
    Join Date
    Sep 2006
    Posts
    81

    Re: VB app takes long time to load

    Quote Originally Posted by sapator View Post
    6-7 Years ago I was working in a company that was selling it's own Framework based on Visual Studio. We had lot of performance issues and most of them I could find out using Visual Studio Performance Analysis.
    Having said that, I don't remember squat of how I was using it but if there is someone here that used it recently he/she might be able to give you some advice.
    So what you can do is go to Analyze --> Start Performance analysis. Run the code that bother you and let us know your results.
    If you haven't used it then I suppose it's difficult to find out what is going on but , again, someone might help you and also, if you are lucky, you might be able to find the functions that are doing most of the work in the summary.
    No functions run at runtime.

    I don't have "-->Start Performance." When I run an analysis from the menu in the screenshot below, it says "code analysis completed" but there are no results in the output window.

    When I check "run on build" in the "code analysis" in the solution properties, and rebuild the solution, the output says, "Warning CA0507 Post-build Code Analysis (FxCopCmd.exe) has been deprecated in favor of FxCop analyzers, which run during build. Refer to https://aka.ms/fxcopanalyzers to migrate to FxCop analyzers"

    Never ran code analysis; am I doing it correctly?
    Attached Images Attached Images   

  26. #26
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    5,882

    Re: VB app takes long time to load

    Hm.
    Maybe because I have VS 2012 Ultimate at Home I have all the options?
    I must look this tomorrow at the office that I have a plethora of Visual Studios if no one answers this.
    But My menu is like this:

    Attachment 180476
    .

  27. #27

    Thread Starter
    Lively Member
    Join Date
    Sep 2006
    Posts
    81

    Re: VB app takes long time to load

    Ok, thanks. Can't open your attachment but I have VS 2019 Enterprise so that's probably why the different menus.

  28. #28
    Fanatic Member
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    748

    Re: VB app takes long time to load

    Almost ALL attachments seem to be dead on arrival on the forum these days, that's why I recommend imgur.

    The font loading problem on startup is a well-known issue for Windows and has existed since the beginning. These days on fast machines it does not matter too much. It should have little effect on your adequately fast machine.

    You still haven't provided data on the binary drive, rotation speed and cache size and type, you haven't looked at the power saving features of your drive, ie. AAM/APM control and seen their settings.

    You have not yet tried it with Defender off but you are about to? I still think it might be this.

    The data to help you is being requested... Help us help you.

  29. #29
    Fanatic Member
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    748

    Re: VB app takes long time to load

    Windows does a lot of cacheing and you can try clearing the caches to see after a quick run whether clearing the cache slows down the program's next initiation.

    Try running this from an administrator console after running your program and see if it affects the speed of its initiation on the next run.

    C:\windows\system32\rundll32.exe advapi32.dll,ProcessIdleTasks

    I can't guarantee that this will even try to clear that area of supposedly cached memory but it is worth a go.

  30. #30

    Thread Starter
    Lively Member
    Join Date
    Sep 2006
    Posts
    81

    Re: VB app takes long time to load

    In my system reports that I gave a download link to, there is all the information you asked for.
    The HDD info is in file disks.txt and the drive is WCC7K4YRV9J4.
    The power reports are in the folder "Power Reports."
    I always have a custom power plan where drives, screen and USB ports never sleep.

    UPDATE:

    I finally did the test with and without Windows Defender and think it's the culprit. Here's what happens:

    When I turn off "Real-time Protention" my app opens in less than 2 seconds every time.
    When I turn it back on, it takes 31 seconds to open the first time and 2 seconds every time after that. A few hours later it will restart the cycle and take 31 seconds to open (seems the cache gets deleted after a few hours)

    If I turn WD off and then immediately back on, it will take 31 seconds to open the first time and then 2-3 secs every time after that. (Even when running the ProcessIdleTasks from the admin command line in between)

    This happens even though the folder with the app was added as an exclusion from WD.

    ********

    So I think it's safe to conclude that Windows Defender is the culprit.
    Now we need to figure out how to keep the WD cache from getting deleted (it probably deletes it every few hours for security reasons)
    Last edited by ZviT; Mar 10th, 2021 at 06:22 AM.

  31. #31
    Fanatic Member
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    748

    Re: VB app takes long time to load

    We can't be expected to visit links, some pertinent information here on the forum is what is required especially when asked twice. Help us to help you, we aren't working for you and so you have to do your bit and probably quite a bit more as you are expected to be technical.

    This is a good guide that may help. https://www.chiark.greenend.org.uk/~sgtatham/bugs.html

    Right from the beginning a few suggested turning off defender, you'd have saved yourself and us some time if you'd just done it.

    Solution from here perhaps might be turn off Windows Defender and try another a/v tool but I am going to guess in advance that you are going to say that you don't want to turn off defender and try another tool.

    However, the idea here is that it will show you whether the other tool works in a different manner to Defender. If it does, then that will also provide you a workaround or a permanent solution if you so choose and then your problem is resolved.

  32. #32

    Thread Starter
    Lively Member
    Join Date
    Sep 2006
    Posts
    81

    Re: VB app takes long time to load

    Just like you had issues with images on the forum and suggested using imgur, the forum was not letting me upload the 2MG zip file, don't know why, so I had no choice but to share a link.

    Attached is what you asked for about the drive.

    You are correct that I want to stay with Windows Defender.
    Attached Images Attached Images   

  33. #33
    Fanatic Member
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    748

    Re: VB app takes long time to load

    OK, I thought that would be the case. From this point on as it is probably more of a problem with a Windows embedded product I suggest you take the problem to people that deal with that sort of Windows problem. This is no longer an actual .NET issue so more suited to other expertise.

    Bleeping computer people might be able to help but I suggest you search out groups with more knowledge of defender and how it operates and interacts with other MS components.

    You now have a workaround and I'd suggest Avast or malwarebytes as an interim until you find out and resolve your issue with defender.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width