|
dyonik wrote: #1: How can my program find out it is not running as native in the assembly cache?
It is ALWAYS running as native. There isn't a processor on this planet that can run MSIL code natively. The JIT compiler detects if the native image is no longer valid for the platform it's running on and will automatically recompile the code and cache a new native image. Your code will never know this happened.
dyonik wrote: #2: Is it possible to start "ngen update <myapp>" while <myapp> is running? (Will that work?)
No, not while the .EXE is running. You'd have to use a seperate update app to do the download and launch the NGEN.
|
|
|
|
|
Hi Dave - Thanks for answering.
Ok point #2 is clear but I think I dit not express my self right in point #1.
What I meant was: How do I find out that the native image is invalid? (Without using Fusion Log Viewer but in a .Net program)
This is necessary so I can update the image if required.
|
|
|
|
|
dyonik wrote: What I meant was: How do I find out that the native image is invalid? (Without using Fusion Log Viewer but in a .Net program)
I'm not convinced you need to deal with this but have you tried renaming the file while it's being used in a process?
|
|
|
|
|
You're not getting it. When your code is running, the native image is ALWAYS valid. If it wasn't, you're code wouldn't be running.
|
|
|
|
|
Dave Kreskowiak wrote: When your code is running, the native image is ALWAYS valid. If it wasn't, you're code wouldn't be running.
Are you sure about that?
If those dependencies change, it invalidates the code in the native image
and the runtime will fail to use the native image, instead reverting to JIT compilation.
link[^]
|
|
|
|
|
led mike wrote: If those dependencies change, it invalidates the code in the native image and the runtime will fail to use the native image, instead reverting to JIT compilation.
Which, a little further down the road, replaces the bad native image with the new one, after the JIT does it's job, of course. He's trying to pre-JIT to native to avoid the delay that happens the first time the JIT has to compile new code.
In his updater .EXE, he can download a new installer and run that, which should be coded to replace the old application and NGEN new images. Other than that, all he has to do to accomplish approximately the same thing is launch the new .EXE and the JIT will compile the parts it needs on the fly, updating the native cache as it goes.
|
|
|
|
|
Dave Kreskowiak wrote: He's trying to pre-JIT to native to avoid the delay that happens the first time the JIT has to compile new code.
Ah, I was missing that completely. I'm not even sure I know what to think of that. Here where I work we would have like 50k problems that would be a higher priority than that one.
|
|
|
|
|
Sure there other problems out there but the tool I wrote needs 15 seconds to startup.
(You might ask what takes so long. It's mostly Windows Forms inits and updates .)
I am talking about warm start - which means the app has been run before. Cold start takes even longer.
That is not acceptable for a repeatedly used tool. Using NGEN the startup time was reduced to under 5 seconds.
That means a much better user experience.
|
|
|
|
|
No, JIT-compiling does not replace or update the native image if it got invalid.
If I start the app and the image is invalid the app is jit-compiled. But that does not update the image.
Thus the app will always be jit compiled till someone updates the native image.
A launcher app is not possible because it would cost additional time - which I want to save.
I thought about automatically updating the image when closing the app.
Because:
* This will not add to my startup time.
* The exe-file CAN be installed by NGEN while it is running. (I tried it.)
* If the native image is invalid the application will still run (but startup slower).
|
|
|
|
|
When parsing a string that contains a date with DateTime.Parse, how can you get the custom DateTime format string that describes the format the string was in? (i.e. "M/d/yyyy" or "M/d/yy", etc.)
|
|
|
|
|
Are you saying that you want to get the format string from an already existing date, like "03/05/2009"??
First, there is no method you can call that will return this. Second, the reason being is in the example I just gave? Is that date March 5th or is it May 3rd?? It's impossible to tell unless the source of the date can be interrogated somehow.
|
|
|
|
|
Yes, but you can assume that the string has already "succesfully" been parsed with DateTime.Parse.
Supposedly DateTime.Parse decides which value is the month by using the culture-specific format information in the IFormatProvider argument. (Of course you can never be sure that that same month-day order was actually intended in the string).
Anyway, if Parse can return a DateTime then the format string is also known. It would be useful to have for instance for later calls to DateTime.ParseExact to see if other strings also follow that same format.
|
|
|
|
|
Like Luc said, it's in the CultureInfo. I thought you're original post said that you wanted to derive the format string from the Date string itself.
|
|
|
|
|
Maybe CultureInfo.DateTimeFormat can help you?
|
|
|
|
|
By default when you add output to Application folder, it copies exe and dependencies (DLLs) in the same folder. I want to copy DLLs in separate folder named "Bin". I was unable to find any solution on this. Can anyone help me...?
|
|
|
|
|
Considering your code has to be modified to allow it to find .DLL files outside of the folder the .EXE was launched from or other than any folder in the PATH, this isn't a good idea.
The Setup and Deployment Wizard does not account for this type of setup. You'd have to customize one by hand in order to do what you want. Personally, I don't use the Setup and Deployment projects in Visual Studio. I use external third party tools, like InnoSetup and Wise Package Studio to create my installers.
|
|
|
|
|
I found it's resolution.
We need to modify App.config to locate DLLs on runtime. We need to write following in App.config under <runtime> configuration element. The following code snippet will tell your exe to get DLLs from "Bin" folder which is located in the same folder where EXE are placed.
<assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatepath="Bin">
Regards,
Wasif Ahmad
Microsoft Certified Professional.
|
|
|
|
|
how to capture image and store in a folder.
tell me the code of that. its in vb.net 2008..
|
|
|
|
|
This site doesn't just hand over code to anyone who asks. We help people write their own code. We will not write it for you.
Capture an image from what device?? Scanner, camera, webcam, Vulcan Mind Meld, ...???
|
|
|
|
|
CapturedImage.Save("Image file path")
The image capture is up to you. Try interfacing with an IP camera or digital camera
|
|
|
|
|
how to prepare application setup in vb.net?
|
|
|
|
|
You can either add a Setup and Deployment project to your solution, or you can use a third-party tool like InnoSetup, Wise Package Studio, InstallShield, or whatever. The steps for creating an installation are long and varied depending on what your setup has to do. This explanation will not fit in a couple of forum posts.
|
|
|
|
|
how to add ms-word in vb.net?
it should open after we click a button.
|
|
|
|
|
Use the <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx">Process</a>[<a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx" target="_blank" title="New Window">^</a>] class. There's a VB.NET example on that same page
I are troll
|
|
|
|
|