Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
At times, Application crashes due to some Runtime exceptions and in some cases it may crash again if we navigate to the same page again.
Sometimes it starts working fine once we clear the Silverlight cache (Path:- C:\Users\myusername\AppData\LocalLow\Microsoft\Silverlight) if it is related to some issue, which updates the cache.

So my question is: does it required to clear the Cache if the Application crashes? This will ensure that the End user will not have to wait for the Support Team to resolve this.

The Exception details anyhow will be logging in somewhere.
Posted
Updated 24-Dec-14 1:07am
v2
Comments
Philippe Mori 24-Dec-14 11:20am    
Very bad idea.

1 solution

No, cache has nothing to do with the application crashes. This problem is because some of the data that you're storing inside the cache, is either null of is invalid for your application, as soon as you clear the data the application starts to run again. End user, as you've said, will have to either clear the cache himself, or will have to contact you people for more information on fixing this problem which would cause a lot of time for you people. Exceptions are raised which cause the application to terminate, it can be as simple as NullReferenceException (in .NET) to terminate your exception. It is a good approach, to always write the statements which might throw an exception in a try catch block like this,

C#
try {
   /* Visual C# code, Java and other codes also resemble (not fully; but much)
    * Write your code statements here, if they execute, good!
    * if, due to some problem they don't. The code in the 
    * catch block would execute, showing the error, instead of crashing
    */
} catch (Exception er) {
   // er is the Exception object, containing information about error
}


Exception Handling (Wikipedia)[^]

What you should do, is inside your IDE, set a few breakpoints to the modules (functions) and then run the application in debug mode. Since you're not telling what the error is, means either that you're running the Release version of the application which doesn't tell which exception was raised and just closes the application, or that you've missed adding the exception details.

Breakpoint (Wikipedia)[^]

You can easily add the breakpoints to your application, and debug it. Upon running, it will let you easily navigate through different processes that take place in your application, and just when it throws exception you can see the values inside the application's cache and which expression or statement threw it. Knowing that line and the value, you can easily understand what the problem is, if you don't know, then you can try to Google for it. Chances are that searching for the Exception name would give you an answer. Upon doing this, you will be able to fix this problem and set a valid conditional block to check against the values, which are valid and if they're not you can simply ignore them or delete them.
 
Share this answer
 
Comments
Mohammed Hameed 24-Dec-14 7:01am    
Hi Afzaal,
Thanks for the detailed information, much appreciated.
I understand that you are explaining about the Debugging & Error handling for the exceptions. But my question is generic, actually I should have framed it as "Is it ok to clear the Silverlight cache...?"
Will update my question now.
Afzaal Ahmad Zeeshan 24-Dec-14 7:05am    
No, you should not clear it because there are some other application using the same framework cache. You should try to work in your own application making it secure and efficient.
[no name] 24-Dec-14 7:11am    
Quote: "You should try to work in your own application making it secure and efficient."

That triggered me to vote a five :)
Afzaal Ahmad Zeeshan 24-Dec-14 8:17am    
Thanks for your vote of 5, Bruno.

If that is the case, then I should start adding "make your applications efficient and user-friendly" to get mote votes! :D
[no name] 24-Dec-14 8:23am    
Sorry Afzaal Ahmad, I forgot the word "finally" ....it triggered me finally.... :) No you don't have to add it, your answers are usually very good and well understandable also for beginners like me.
Bruno

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900