如果应用程序崩溃,可以以编程方式清除Silverlight缓存吗?

问题描述:

有时,由于某些运行时异常应用程序崩溃,在某些情况下,如果我们再次导航到同一页面,它可能会再次崩溃。

有时一旦我们清除了 Silverlight缓存路径: - C:\ Users \ myusername \ AppData \ LocalLow \ Mysoftoft \ Silverlight ),它就会正常工作>)如果它与某些问题有关,它会更新缓存。



所以我的问题是:如果应用程序崩溃,是否需要清除缓存?这将确保最终用户不必等待支持团队解决此问题。



异常详细信息无论如何将在某处登录。

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.

不,缓存与应用程序崩溃无关。出现此问题的原因是,一旦清除了应用程序再次开始运行的数据,您存储在缓存中的某些数据为null对您的应用程序无效。正如您所说,最终用户必须自己清除缓存,或者必须与您联系以获取有关解决此问题的更多信息,这将为您造成大量时间。引发异常会导致应用程序终止,它可以像NullReferenceException(在.NET中)一样简单来终止您的异常。这是一个很好的方法,总是编写可能会在这样的try catch块中抛出异常的语句,



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,

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
}





异常处理(*) [ ^ ]



您应该做什么,在IDE中,为模块(函数)设置几个断点,然后在调试模式下运行应用程序。由于您没有告诉错误是什么,意味着您正在运行应用程序的发行版本,该版本不会引发引发的异常,只是关闭应用程序,或者您错过了添加异常详细信息。



断点(*) [ ^ ]



你可以轻松地将断点添加到您的应用程序,并进行调试。运行后,它将让您轻松浏览应用程序中发生的不同进程,并且只有在抛出异常时,您才能看到应用程序缓存中的值以及抛出它的表达式或语句。知道这条线和价值,你可以很容易地理解问题是什么,如果你不知道,那么你可以尝试谷歌为它。有可能搜索异常名称会给你一个答案。执行此操作后,您将能够解决此问题并设置有效的条件块以检查有效的值,如果不是,则可以忽略它们或删除它们。



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.