tags:

views:

61

answers:

3

I have a VB6 app which brings up a form by invoking a .NET DLL, but the problem is that this form takes almost 5 seconds to appear when the menu item is first selected in the VB6 app is selected. How can I speed this up?

It is only slow for the first time, thereafter it is at an acceptable speed, like it is a native VB6 form.

I'm thinking that one possible solution is to load the Form from the .NET DLL during the splash screen of the VB6 app but make invisible or somehow not show it, and then when the menu item is selected I will make it show or visible.

What are my options?

A: 

I'd guess that it's the fact that you have to load the .Net framework. You could just add a dummy method to your .Net dll that doesn't really do anything and then call that during the splash screen, this way everything should be loaded already.

ho1
or if possible, call that dummy method async during start-up/splash screen.
James Manning
It is already creating a (non-interactive) .NET object during the splash so perhaps this isn't the cause, but I think maybe the assembly for the .NET form is having to load for the first time? Each time afterwards there is much less delay.
Craig Johnston
A: 

I dont know exactly what the problem is, but i would suggest to first, investigate the problem in more detail using method profiling, to see which method exactly takes so much time.

But my guess would be that the VB6 app needs to load all sorts of .NET Dlls runtime into memory.. which takes all the time, you can do it by loading all of the Dlls when your program start - i think any call to .NET function will cause the dlls to load, so you can just add a simple method inside your form, that doesnt actually do anything, call it during splash screen and it should help..

but again, this is only an educated guess, investigate.. use sysinternals to see which DLLS are being loaded..

MindFold
A: 

There are several small thing you can do, changing the framework versions > fx3.5, reduce the size of your assemblies, reduce the number of calls the .net dll makes and running NGEN on the assemblies.

Iain
Doesn't running of NGEN need to happen on all deployed machines?
Craig Johnston
its deployed as part of .net from work %windir%\Microsoft.net\Framework\v?.?????\ngen.exe
Iain
Yes, but the ngen of my .NET assembly must be run separately on the deployed machine, not as part of the .net framework installation.
Craig Johnston