Global Exceptionhandler does not catch some Exception (for example StackoverflowException) - wpf

I have registered global Exceptionhandlers in my Application (C#, WPF, .NET4) at the startup-routine on the following way:
AppDomain.CurrentDomain.UnhandledException += (sender, args) => HandleException(args.ExceptionObject as Exception);
Application.Current.DispatcherUnhandledException += (sender, args) => {
HandleException(args.Exception);
args.Handled = true;
};
Where HandleException() does logging the Exception and showing a MessageBox with some additional information.
Now, there are from time to time crashes of my application on some customer machines, where HandleException() is not called. Windows is showing the following message:
In the WindowsEventLog, I get the following entries:
Entry1:
Name der fehlerhaften Anwendung: proconact.exe, Version: 1.0.0.1365, Zeitstempel: 0x511531df
Name des fehlerhaften Moduls: PresentationFramework.ni.dll, Version: 4.0.30319.588, Zeitstempel: 0x504db27d
Ausnahmecode: 0xc00000fd
Fehleroffset: 0x002ef05b
ID des fehlerhaften Prozesses: 0x1bec
Startzeit der fehlerhaften Anwendung: 0x01ce0b5dce4030a6
Pfad der fehlerhaften Anwendung: C:\Program Files (x86)\proconact_sck\proconact.exe
Pfad des fehlerhaften Moduls: C:\windows\assembly\NativeImages_v4.0.30319_32\PresentationFramewo#\c627e9b7f10b01db43645284e601f255\PresentationFramework.ni.dll
Berichtskennung: d8d69f94-777a-11e2-b4b0-b4b52f2aad4f
Entry2:
Fehlerbucket 3482664247, Typ 5
Ereignisname: CLR20r3
Antwort: Nicht verfügbar
CAB-Datei-ID: 0
Problemsignatur:
P1: proconact.exe
P2: 1.0.0.1365
P3: 511531df
P4: PresentationFramework
P5: 4.0.0.0
P6: 504db27d
P7: 329d
P8: 0
P9: System.StackOverflowException
P10:
Angefügte Dateien:
d:\Temp\WER6E9F.tmp.WERInternalMetadata.xml
Diese Dateien befinden sich möglicherweise hier:
C:\Users\roger\AppData\Local\Microsoft\Windows\WER\ReportArchive\AppCrash_proconact.exe_b0fabce1f86d1f843de5b5b4692a3e8ecd928_2c77f03d
Analysesymbol:
Es wird erneut nach einer Lösung gesucht: 0
Berichts-ID: d8d69f94-777a-11e2-b4b0-b4b52f2aad4f
Berichtstatus: 0
What can I do that I can handle the Exception (for the meanreason to get the stacktrace for analysis where the exception occurs)?

Some exceptions cannot be caught, not even by AppDomain.UnhandledException. Because they are too nasty to permit managed code to keep running.
StackOverflowException is heart attack like that, infamous enough to give this web site its name. There is not enough stack space left to do common managed code execution duties, like running the jitter. ExecutionEngineException is another one, triggered by a destroyed garbage-collected heap and uncatchable in .NET 4.0 and up.
So no, the show is over and the WER dialog and the Windows event log entry is all that's left to look at. SO is always caused by a bug, you'll need to fix it.

Related

Unable to load 'eeptools' package in R

After an update that I needed for another package, I can no longer use 'eeptools' to calculate the age. When I try, I always get the following error message:
Fehler: Laden von Paket oder Namensraum für ‘eeptools’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]): fehlgeschlagen
es gibt kein Paket namens ‘minqa’
I have already tried deleting the package from the location and reinstalling it. Loading the "Minqa" package also failed.
I am grateful for any tips!

Codename One: understand warnings and SecurityException after upgrading from JDK23 to JDK27

On May 2018, Codename One was moved to Android API Level 27.
Previously I loaded in the store the version 0.1 of an app built with Codename One, with the Android API Level 23 (that was the previous default).
Google is forcing all its developers to upgrade the APPs to the newer API before the 1st November 2018, that's why I submitted to the store, few days ago, the same app, without any code modification, built with the last version of Codename One.
Today I received the following crash protection report. My question is an help to understand all the warnings and the java.lang.SecurityException. My app doesn't require any special permission and don't ask permissions to the user during the running (it's a very simple app). Before upgrading the app to the API Level 27 I never got these warnings and this exception.
[EDT] 0:0:0,1 - Codename One revisions: 38629bb7dc1724677b602b7cf175bee9bf0d67c8
[EDT] 0:0:0,4 - WARNING: Theme sets the commandBehavior constant which is deprecated. Please update the theme to NOT include this theme constant. Using commandBehavior may cause your app to perform in unexpected ways. In particular, using SIDE command behavior in conjunction with Toolbar.setOnTopSideMenu(true) may result in runtime exceptions.
[EDT] 0:0:0,6 - WARNING: Display.setCommandBehavior() is deprecated, Using it may result in unexpected behaviour. In particular, using COMMAND_BEHAVIOR_SIDE_NAVIGATION in conjunction with Toolbar.setOnTopSideMenu(true) may result in runtime errors.
[EDT] 0:0:0,11 - STARTING of the app "Giorno per giorno" version 0.2
[EDT] 0:0:0,12 - Platform: Unknown
[EDT] 0:0:0,13 - Platform Name: and
[EDT] 0:0:0,15 - OS: Android
[EDT] 0:0:0,17 - OS Version: 8.0.0
[EDT] 0:0:0,19 - Display Width: 1080
[EDT] 0:0:0,20 - Display Height: 2150
[EDT] 0:0:0,22 - Device density: DENSITY_HD
[EDT] 0:0:0,23 - mese: 10
[EDT] 0:0:0,24 - giorno del mese: 19
[EDT] 0:0:0,36 - I'm trying to open the file /giorno-293.txt
[EDT] 0:0:0,38 - File opened successfully
[EDT] 0:0:0,38 - isNativeShareSupported: true
[EDT] 0:0:0,874 - Exception: java.lang.SecurityException - Permission Denial: starting Intent { act=android.intent.action.MAIN flg=0x10400000 cmp=com.huawei.android.launcher/.powersavemode.PowerSaveModeLauncher (has extras) } from ProcessRecord{e69f9b7 13566:cloud.amoremio.app.daybyday/u0a110} (pid=13566, uid=10110) not exported from uid 10072
java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN flg=0x10400000 cmp=com.huawei.android.launcher/.powersavemode.PowerSaveModeLauncher (has extras) } from ProcessRecord{e69f9b7 13566:cloud.amoremio.app.daybyday/u0a110} (pid=13566, uid=10110) not exported from uid 10072
at android.os.Parcel.readException(Parcel.java:1946)
at android.os.Parcel.readException(Parcel.java:1892)
at android.app.IActivityManager$Stub$Proxy.startActivity(IActivityManager.java:4373)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1631)
at android.app.Activity.startActivityForResult(Activity.java:4751)
at android.app.Activity.startActivityForResult(Activity.java:4691)
at com.codename1.impl.android.CodenameOneActivity.startActivityForResult(CodenameOneActivity.java:576)
at android.app.Activity.startActivity(Activity.java:5112)
at android.app.Activity.startActivity(Activity.java:5080)
at com.codename1.impl.android.CodenameOneActivity.startActivity(CodenameOneActivity.java:590)
at com.codename1.impl.android.d.W(AndroidImplementation.java:1311)
at com.codename1.s.q.o(Display.java:1546)
at com.codename1.s.ab.c(MenuBar.java:1413)
at com.codename1.s.aj.c(SideMenuBar.java:704)
at com.codename1.s.u.c(Form.java:2748)
at com.codename1.s.q.a(Display.java:2015)
at com.codename1.s.q.j(Display.java:1043)
at com.codename1.s.q.i(Display.java:961)
at com.codename1.s.ai.run(RunnableWrapper.java:120)
at com.codename1.impl.b$1.run(CodenameOneThread.java:60)
at java.lang.Thread.run(Thread.java:784)
[EDT] 0:0:0,877 - Exception in Giorno per giorno version 0.2
[EDT] 0:0:0,877 - OS and
[EDT] 0:0:0,878 - Error java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN flg=0x10400000 cmp=com.huawei.android.launcher/.powersavemode.PowerSaveModeLauncher (has extras) } from ProcessRecord{e69f9b7 13566:cloud.amoremio.app.daybyday/u0a110} (pid=13566, uid=10110) not exported from uid 10072
[EDT] 0:0:0,878 - Current Form null
[EDT] 0:0:0,879 - Exception: java.lang.SecurityException - Permission Denial: starting Intent { act=android.intent.action.MAIN flg=0x10400000 cmp=com.huawei.android.launcher/.powersavemode.PowerSaveModeLauncher (has extras) } from ProcessRecord{e69f9b7 13566:cloud.amoremio.app.daybyday/u0a110} (pid=13566, uid=10110) not exported from uid 10072
java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN flg=0x10400000 cmp=com.huawei.android.launcher/.powersavemode.PowerSaveModeLauncher (has extras) } from ProcessRecord{e69f9b7 13566:cloud.amoremio.app.daybyday/u0a110} (pid=13566, uid=10110) not exported from uid 10072
at android.os.Parcel.readException(Parcel.java:1946)
at android.os.Parcel.readException(Parcel.java:1892)
at android.app.IActivityManager$Stub$Proxy.startActivity(IActivityManager.java:4373)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1631)
at android.app.Activity.startActivityForResult(Activity.java:4751)
at android.app.Activity.startActivityForResult(Activity.java:4691)
at com.codename1.impl.android.CodenameOneActivity.startActivityForResult(CodenameOneActivity.java:576)
at android.app.Activity.startActivity(Activity.java:5112)
at android.app.Activity.startActivity(Activity.java:5080)
at com.codename1.impl.android.CodenameOneActivity.startActivity(CodenameOneActivity.java:590)
at com.codename1.impl.android.d.W(AndroidImplementation.java:1311)
at com.codename1.s.q.o(Display.java:1546)
at com.codename1.s.ab.c(MenuBar.java:1413)
at com.codename1.s.aj.c(SideMenuBar.java:704)
at com.codename1.s.u.c(Form.java:2748)
at com.codename1.s.q.a(Display.java:2015)
at com.codename1.s.q.j(Display.java:1043)
at com.codename1.s.q.i(Display.java:961)
at com.codename1.s.ai.run(RunnableWrapper.java:120)
at com.codename1.impl.b$1.run(CodenameOneThread.java:60)
at java.lang.Thread.run(Thread.java:784)
This seems to be a bug in the Huawei launcher. When a user presses the back button in the applications main form we minimize the application by default (as is the convention in Android). The minimize method is implemented as such on Android:
public boolean minimizeApplication() {
Intent startMain = new Intent(Intent.ACTION_MAIN);
startMain.addCategory(Intent.CATEGORY_HOME);
startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startMain.putExtra("WaitForResult", Boolean.FALSE);
getContext().startActivity(startMain);
return true;
}
This essentially asks the system to go back "home". It doesn't require permissions or anything specific but it seems Huawei misconfigured their activity and this fails. I think this just means backing out of the app on these devices will fail. The user can probably still use the home button itself instead of the back button.
Unfortunately it seems Huawei don't have a public bug reporting system. Hopefully they'll fix this issue or a workaround will emerge.

Handling an IAsyncOperation<StorageFile^>^ object in C++/CX

I want to create a file in the local folder, so I have written the following code:
IAsyncOperation<StorageFile^>^ fileTask = Windows::Storage::ApplicationData::Current->LocalFolder->CreateFileAsync("example.dat");
But how should I handle the fileTask?
I have tried to call the GetResults-method, but then I get following exception:
Ausnahme ausgelöst bei 0x00007FFD211C7788 (KernelBase.dll) in Test.exe: 0x40080201: WinRT originate error (Parameter: 0x000000008000000E, 0x0000000000000040, 0x000000C00EBFC470).
Ausnahme ausgelöst bei 0x00007FFD211C7788 in Test.exe: Microsoft C++-Ausnahme: Platform::COMException ^ bei Speicherort 0x000000C00EBFC730. HRESULT:0x8000000E Eine Methode wurde zu einem unerwarteten Zeitpunkt aufgerufen.
WinRT-Informationen: Eine Methode wurde zu einem unerwarteten Zeitpunkt aufgerufen.
Next I have tried to use create_task:
create_task(Windows::Storage::ApplicationData::Current->LocalFolder->CreateFileAsync("example.dat")).then([this](StorageFile^ file)
{
// irrelevant
});
Exception:
Ausnahme ausgelöst bei 0x00007FFD211C7788 (KernelBase.dll) in Test.exe: 0x40080201: WinRT originate error (Parameter: 0x00000000800700B7, 0x0000000000000048, 0x000000A936DFB230).
Ausnahme ausgelöst bei 0x00007FFD211C7788 (KernelBase.dll) in Test.exe: 0xE06D7363: Microsoft C++ Exception (Parameter: 0xCCCCCCCC19930520, 0x000000A936DFB830, 0x00007FFD01398AD0, 0x00007FFD012C0000).
Sorry for the language
How could I solve this Problem?
Next I have tried to use create_task...
You are in the correct direction. It is recommended to use task class for async operation.
But the file example.dat is probably already there when you call the GetResults. Thus you won't be able to use create_task(Windows::Storage::ApplicationData::Current->LocalFolder->CreateFileAsync("example.dat")).then([this](StorageFile^ file) to create the file again.
To fix the problem, just modify the codes like below:
#include <ppltasks.h>
create_task(Windows::Storage::ApplicationData::Current->LocalFolder->CreateFileAsync("example.dat", CreationCollisionOption::ReplaceExisting)).then([this](StorageFile^ file)
{
});
Added CreationCollisionOption::ReplaceExisting so that everytime the new file will replace the old file. And don't forget to include the ppltask.h.

EDT violation on Codename One

With this code:
protected void second_ButtonAction(Component c, ActionEvent event) {
ConnectionRequest cn = new ConnectionRequest();
cn.setUrl(theURLaddress);
cn.setPost(false);
cn.addArgument("name", "this");
NetworkManager.getInstance().addToQueueAndWait(cn);
cn.getResponseData();
}
I keep getting the following:
EDT violation detected!
com.codename1.impl.javase.JavaSEPort$EDTViolation: EDT Violation Stack!
at com.codename1.impl.javase.JavaSEPort.checkEDT(JavaSEPort.java:344)
EDT violation detected!
EDT violation detected!
EDT violation detected!
at com.codename1.impl.javase.JavaSEPort.isNativeInputSupported(JavaSEPort.java:2459)
at com.codename1.ui.Display.isNativeInputSupported(Display.java:2306)
at com.codename1.ui.TextArea.setText(TextArea.java:406)
at com.codename1.ui.TextArea.<init>(TextArea.java:328)
at com.codename1.ui.TextArea.<init>(TextArea.java:257)
at com.codename1.ui.Dialog.show(Dialog.java:771)
at com.codename1.ui.Dialog.show(Dialog.java:727)
at com.codename1.ui.Dialog.show(Dialog.java:692)
at com.codename1.ui.Dialog.show(Dialog.java:536)
at com.codename1.ui.Dialog.show(Dialog.java:788)
at com.codename1.io.ConnectionRequest.handleErrorResponseCode(ConnectionRequest.java:680)
at com.codename1.io.ConnectionRequest.performOperation(ConnectionRequest.java:379)
at com.codename1.io.NetworkManager$NetworkThread.run(NetworkManager.java:261)
at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)
com.codename1.impl.javase.JavaSEPort$EDTViolation: EDT Violation Stack!
at com.codename1.impl.javase.JavaSEPort.checkEDT(JavaSEPort.java:344)
at com.codename1.impl.javase.JavaSEPort.getImageWidth(JavaSEPort.java:3087)
at com.codename1.ui.Image.getWidth(Image.java:667)
at com.codename1.ui.EncodedImage.getWidth(EncodedImage.java:413)
at com.codename1.ui.plaf.Border.getMinimumWidth(Border.java:200)
at com.codename1.ui.Container.calcPreferredSize(Container.java:1431)
at com.codename1.ui.Component.calcScrollSize(Component.java:579)
at com.codename1.ui.Component.getScrollDimension(Component.java:566)
at com.codename1.ui.Container.isScrollableY(Container.java:1495)
at com.codename1.ui.Component.isScrollable(Component.java:1413)
at com.codename1.ui.Container.setLayout(Container.java:246)
at com.codename1.ui.Dialog.<init>(Dialog.java:205)
at com.codename1.ui.Dialog.<init>(Dialog.java:189)
at com.codename1.ui.Dialog.<init>(Dialog.java:180)
at com.codename1.ui.Dialog.show(Dialog.java:952)
EDT violation detected!
...
What am I missing!!?
Except for the lack of progress indication the code above looks fine.
It seems you are invoking setText off the EDT elsewhere but you cut the stack trace that pointed at that.
Edited:
From the revised stack trace it seems that this line is the important one:
at com.codename1.io.ConnectionRequest.handleErrorResponseCode(ConnectionRequest.java:680)
You are getting a call to the handleErrorResponseCode which means the URL returned an error code. So we are showing you an error dialog. Yes it does violate the EDT (these exceptions are in the simulator to warn of potential bugs). You need to decide what to do on error response code and handle them appropriately either by deriving the connection request and overriding this method or by binding an error handler to the network manager or by invoking setFailSilently(true) on the connection request.

SQLite on a WPF-Application

When i want to implement SQLite in a WPF-Application (.Net Framework 4), the programm failed (in the debugger-mode) with this message:
"Eine Ausnahme (erste Chance) des Typs "System.Windows.Markup.XamlParseException" ist in PresentationFramework.dll aufgetreten.
Zusätzliche Informationen: Zeilennummer "3" und Zeilenposition "9" von "Durch den Aufruf des Konstruktors für Typ "Kasse.MainWindow", der den angegebenen Bindungseinschränkungen entspricht, wurde eine Ausnahme ausgelöst.".
(this is german, here is the version, that is translated by Google-Translator):
An exception (first chance) of type System.Windows.Markup.XamlParseException 'occurred in PresentationFramework.dll.
Additional information: line number "3 " and line position "9 " "By calling the constructor for type Kasse.MainWindow" which matches the specified binding constraints, was an exception.
What should i do?
Greetings,
GreenPepper
This probably means that you are getting an exception in the constructor of the code-behind class of your window. Try setting a breakpoint and step through your constructor.

Resources