I am working on a program (c# in Visual Studio), which has a strange behaviour.
I implemented a feature, that starts the program on windows start up (autostart).
For that I add in the registry path:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
The filepath of the program.
And it starts on start up.
But the App Crashes. When I start it manually - it works perfectly.
I dont understand, why the app has a different behaviour when I start it manually or with autostart. (I am using no parameters)
So I would like to debug it while simulating this autostart, but i dont know how to.
I am currently working on a logwriter, to see where the problem is, but it would be better, if I can debug it somehow.
The Eventlog (german), when the app crash on autostart, tells me:
Name der fehlerhaften Anwendung: myapp.exe, Version:19.4.25.0, Zeitstempel: 0x5cc1a6d1 Name des fehlerhaften Moduls: KERNELBASE.dll, Version: 6.2.17134.556, Zeitstempel: 0xb9f4a0f1
Ausnahmecode: 0xe053534f
Fehleroffset: 0x000000000003a388
ID des fehlerhaften Prozesses: 0x%9
Startzeit der fehlerhaften Anwendung: 0x%10
Pfad der fehlerhaften Anwendung: %11
Pfad des fehlerhaften Moduls: %12
Berichtskennung: %13
Vollständiger Name des fehlerhaften Pakets: %14
Anwendungs-ID, die relativ zum fehlerhaften Paket ist: %15
I'm not getting clever out of it, too.
Maybe you have some hints for me - best if you can show me a possiblity to simulate the autostart in order to debug the app:)
Related
My C# / WinForms app crashes at startup.
I went through several posts here that cover that topic but I wasn't able to solve the problem yet.
That is the error I get:
Problemsignature:
Problemeventname: APPCRASH
Applicationname: MyApp.exe
Applicationversion: 1.0.0.0
Applicationtimestamp: 5b4c47c9
Faultedmodulename: KERNELBASE.dll
Faultedmoduleversion: 6.1.7601.24150
Faultedmoduletimestamp: 5b0cbc65
Exceptioncode: e0434352
Exceptionoffset: 000000000001a06d
Operatingsystemversion: 6.1.7601.2.1.0.272.7
Location-ID: 1031
Additionalinformation 1: 367e
Additionalinformation 2: 367e805d0e7c1ec3f63b05bb5ce5c416
Additionalinformation 3: 5a60
Additionalinformation 4: 5a6090e598b447a9043f485266c8e273
I searched for more detailed logs and found this:
Version=1
EventType=APPCRASH
EventTime=131762111243226835
ReportType=2
Consent=1
ReportIdentifier=6925141c-88e4-11e8-a994-000c2920c559
IntegratorReportIdentifier=6925141b-88e4-11e8-a994-000c2920c559
Response.type=4
Sig[0].Name=Applicationname
Sig[0].Value=MyApp.exe
Sig[1].Name=Applicationversion
Sig[1].Value=1.0.0.0
Sig[2].Name=Applicationtimestamp
Sig[2].Value=5b4c47c9
Sig[3].Name=Faultedmodulename
Sig[3].Value=KERNELBASE.dll
Sig[4].Name=Faultedmoduleversion
Sig[4].Value=6.1.7601.24150
Sig[5].Name=Faultedmoduletimestamp
Sig[5].Value=5b0cbc65
Sig[6].Name=Exceptioncode
Sig[6].Value=e0434352
Sig[7].Name=Exceptionoffset
Sig[7].Value=000000000001a06d
DynamicSig[1].Name=Operatingsystemversion
DynamicSig[1].Value=6.1.7601.2.1.0.272.7
DynamicSig[2].Name=Location-ID
DynamicSig[2].Value=1031
DynamicSig[22].Name=Additionalinformation 1
DynamicSig[22].Value=367e
DynamicSig[23].Name=Additionalinformation 2
DynamicSig[23].Value=367e805d0e7c1ec3f63b05bb5ce5c416
DynamicSig[24].Name=Additionalinformation 3
DynamicSig[24].Value=5a60
DynamicSig[25].Name=Additionalinformation 4
DynamicSig[25].Value=5a6090e598b447a9043f485266c8e273
UI[2]=C:\Program Files\MyApp\MyApp.exe
UI[3]=MyApp stopped working
UI[4]=Windows can look online for a solution to the problem.
UI[5]=Search online for a solution and close the program
UI[6]=Search for a solution online later and close the program
UI[7]=Close the program
LoadedModule[0]=C:\Program Files\MyApp\MyApp.exe
LoadedModule[1]=C:\Windows\SYSTEM32\ntdll.dll
LoadedModule[2]=C:\Windows\SYSTEM32\MSCOREE.DLL
LoadedModule[3]=C:\Windows\system32\KERNEL32.dll
LoadedModule[4]=C:\Windows\system32\KERNELBASE.dll
LoadedModule[5]=C:\Windows\system32\ADVAPI32.dll
LoadedModule[6]=C:\Windows\system32\msvcrt.dll
LoadedModule[7]=C:\Windows\SYSTEM32\sechost.dll
LoadedModule[8]=C:\Windows\system32\RPCRT4.dll
LoadedModule[9]=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscoreei.dll
LoadedModule[10]=C:\Windows\system32\SHLWAPI.dll
LoadedModule[11]=C:\Windows\system32\GDI32.dll
LoadedModule[12]=C:\Windows\system32\USER32.dll
LoadedModule[13]=C:\Windows\system32\LPK.dll
LoadedModule[14]=C:\Windows\system32\USP10.dll
LoadedModule[15]=C:\Windows\system32\IMM32.DLL
LoadedModule[16]=C:\Windows\system32\MSCTF.dll
LoadedModule[17]=C:\PROGRA~2\Sophos\SOPHOS~1\SOPHOS~2.DLL
LoadedModule[18]=C:\Windows\system32\PSAPI.DLL
LoadedModule[19]=C:\Windows\system32\VERSION.dll
LoadedModule[20]=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
LoadedModule[21]=C:\Windows\system32\MSVCR120_CLR0400.dll
LoadedModule[22]=C:\Windows\assembly\NativeImages_v4.0.30319_64\mscorlib\ccb48f84a5cca36e9b0205b6a65ee54a\mscorlib.ni.dll
LoadedModule[23]=C:\Windows\system32\ole32.dll
LoadedModule[24]=C:\Windows\system32\CRYPTBASE.dll
LoadedModule[25]=C:\Program Files (x86)\TeamViewer\tv_x64.dll
LoadedModule[26]=C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_5.82.7601.18837_none_a4d981ff711297b6\COMCTL32.dll
LoadedModule[27]=C:\Windows\system32\SHELL32.dll
LoadedModule[28]=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clrjit.dll
LoadedModule[29]=C:\Windows\system32\CRYPTSP.dll
LoadedModule[30]=C:\Windows\system32\rsaenh.dll
LoadedModule[31]=C:\Windows\system32\RpcRtRemote.dll
LoadedModule[32]=C:\Windows\assembly\NativeImages_v4.0.30319_64\System\4575f30d7b13f1377c287e162ba3147e\System.ni.dll
LoadedModule[33]=C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Drawing\3b5c30aa581d90fd18f9593f9c842b6d\System.Drawing.ni.dll
LoadedModule[34]=C:\Windows\assembly\NativeImages_v4.0.30319_64\System.Windows.Forms\7a911b66e6652a094625f0ce974dc434\System.Windows.Forms.ni.dll
LoadedModule[35]=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\diasymreader.dll
FriendlyEventName=No longer functional
ConsentKey=APPCRASH
AppName=MyApp
AppPath=C:\Program Files\MyApp\MyApp.exe
However, that doesn't really help me. I've checked the startup of the app in debug mode (different machine) where I am able to run it and logged the loaded assemblies. I went over each assembly and checked whether it was available on the other machine. Everything was there, although some assemblies are not available in the GAC but in the apps directory.
I have no idea where to look now, thanks for your help!
Edit: I get this message in the event viewer:
Anwendung: MyApp.exe
Frameworkversion: v4.0.30319
Beschreibung: Der Prozess wurde aufgrund einer unbehandelten Ausnahme beendet.
Ausnahmeinformationen: System.IO.FileLoadException
bei MyApp.Program.Main()
Is there a way to get more information which assembly is missing?
I solved my issue by checking the versions of the referenced assembly. One third-party assembly had a minor update which I forgot to update in my clients folder.
Always when I request E-Mails from my Outlook, which uses Office365 a COM-Exception is thrown, after a count of mails. I really have no idea why...
Error:
System.Runtime.InteropServices.COMException (0xBFE40305):
Die Anzahl der Elemente, die gleichzeitig geöffnet werden können, wurde vom Serveradministrator begrenzt.
Schließen Sie zunächst geöffnete Nachrichten, oder entfernen Sie Anhänge und Bilder von
ungesendeten Nachrichten, die Sie gerade verfassen.
bei Microsoft.Office.Interop.Outlook._MailItem.get_Recipients()
.....
For the people that don't speak German, it means:
The count of the elements which could be opened at the same time, is limited by the server administrator (....)
I don't know anything about such a Limit, and the solution which I can find on Google or MSDN don't help ether.
It looks like it crashes when the program tries to get the E-Mail recipients. Here is the way, how I try to get the Recipients:
foreach (var item in SelectedFolder.Items.Restrict(filter))
{
Outlook.MailItem mail = item as Outlook.MailItem;
if (mail != null)
{
if (mail.Recipients.Count > 0)
{
string caption = mail.Subject;
string MAIL = mail.Recipients[1].PropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x39FE001E"); //<--- CRASH HERE
I really don't understand, how this can happen, as far I know, when I select E-Mails from Outlook, they just get "opened" local... So I can't get, how a "Server-Limit" can access to this.
In the online mode the number of simultaneously open objects is limited by the Exchange provider (since each object opens a separate RPC channel).
For the messages, the limit is 255 by default.
Do not use a foreach loop - it will keep each member of the loop referenced until the loop exits. Use a for loop and explicitly release the item (and all of its subjects that you retrieved, such as recipients or attachments) at the end of each iteration using Marshal.ReleaseComObject(). Avoid using multiple dot notation as that forces the compiler to create implicit variables that you cannot explicitly release.
Also keep in mind that the as operator also produces an implicit variable - break that line into two and release both variables using Marshal.ReleaseComObject()
my Problem is as follows.
I generate a default Email(type of MailMessage) in C# and want to Send it through a smptclient. But before that I want to Open and Edit it in Outlook or whatever Email Program is installed. Right now I'm doing this:
message.Save(fileName, true);
Process.Start(fileName);
Save is an extension Method copied from this Post
But now ofcourse the Mailprogramm tries to Send the Mail itself... I Need however an default Sender. So if I try to Send it through Outlook I get an Error Mail like :
Ihre Nachricht hat einige oder alle Empfänger nicht erreicht.
Betreff: Test report 18.03.2016
Gesendet am: 18.03.2016 10:36
Folgende(r) Empfänger kann/können nicht erreicht werden:
Max Muster am 18.03.2016 10:36
Diese Nachricht konnte nicht gesendet werden. Versuchen Sie es später erneut, oder wenden Sie sich an den
Netzwerkadministrator. Sie besitzen nicht die Berechtigung, die
Nachricht im Auftrag des angegebenen Benutzers zu senden. Fehler:
[0x80070005-0x0004dc-0x000524].
Which translated boils down to :
Couldn't deliver Mail. You don't have Permission to Send the Message from the specified User. Error: [0x80070005-0x0004dc-0x000524]
Sorry I don't have an English Error Message.
Is there any way to pass an specific SMPT Server to a mailObject? So that any Email program opening the Mail, will use this Server instead?
I have the following problem:
I am using a German Windows7-machine (Culture: "de-DE"), but I want to use the SpeechRecognitionEngine-class with an other culture.
However, the following code throws an ArgumentException:
using (SpeechRecognitionEngine rec = new SpeechRecognitionEngine(new CultureInfo("en-GB"))) //ArgumentException
{
rec.LoadGrammar(new DictationGrammar("grammar:dictation#spelling"));
rec.SpeechRecognized += rec_SpeechRecognized;
rec.SetInputToDefaultAudioDevice();
rec.RecognizeAsync(RecognizeMode.Multiple);
...
}
The Exception message is the following:
Es wurde kein Erkennungsmodul mit der erforderlichen ID gefunden.
Translation:
No recognition module with the required ID could be found.
Does this mean, that some sort of language package is missing on my machine?
I suggest the en-GB-packet has to be installed on the machine.
EDIT:
It would be also reasonable to use a try catch block to prevent the app from crashing if the packet is not available.
I'm currently working on a custom Minecraft 1.6.4 launcher.
I have written most of the code is C# however I'm writing the final piece of code in batch.
This seems to work to launch the minecraft 1.5.2 jar
cd "%~1"
java -Xms512m -Xmx1g -Djava.library.path=Bin\bin\native\ -cp Bin\bin\* net.minecraft.client.Minecraft %~2 %~3
pause
(C# Works out the session ID (%~3))
However in minecraft 1.6.4 I get an error:
Error: Could not find or load main class net.minecraft.client.Minecraft
I have heard about a change in the way Minecraft launches, is there anyway for me to implement the new system into my launcher?
If there is a way to do it without batch that would be awesome!
C# code to launch the batch file:
string sessionID = Session.DoLogin(tbUser.Text, tbPassword.Text).SessionId;
Process p = Process.Start("launch.bat", #"""" + filePath + #"""" + " " + tbUser.Text + " " + sessionID);
p.WaitForExit();
I was the first to make a C# launcher for minecraft and I'm happy to share some experiences. I'm sorry to reply to you so late!
Note that you are looking to start the class "net.minecraft.client.main.Main" instead of "net.minecraft.client.Minecraft". I came across this as well when I had to port my launcher to 1.6. It still works for 1.7.4 currently.
The example below is a cleaned up batch command straight from my (EDIT: OLD, but gold) open source launcher
Minecraft 1.7.4 batch launch (jvm arguments):
java
-Djava.library.path=C:\Users\<username>\AppData\Roaming\.minecraft\libraries\org\lwjgl\lwjgl\lwjgl-platform\2.9.0\
-cp
C:\Users\<username>\AppData\Roaming\.minecraft\versions\1.7.4\1.7.4.jar;
C:\Users\<username>\AppData\Roaming\.minecraft\libraries\java3d\vecmath\1.3.1\vecmath-1.3.1.jar;
C:\Users\<username>\AppData\Roaming\.minecraft\libraries\net\sf\trove4j\trove4j\3.0.3\trove4j-3.0.3.jar;
C:\Users\<username>\AppData\Roaming\.minecraft\libraries\com\ibm\icu\icu4j-core-mojang\51.2\icu4j-core-mojang-51.2.jar;
C:\Users\<username>\AppData\Roaming\.minecraft\libraries\net\sf\jopt-simple\jopt-simple\4.5\jopt-simple-4.5.jar;
C:\Users\<username>\AppData\Roaming\.minecraft\libraries\com\paulscode\codecjorbis\20101023\codecjorbis-20101023.jar;
C:\Users\<username>\AppData\Roaming\.minecraft\libraries\com\paulscode\codecwav\20101023\codecwav-20101023.jar;
C:\Users\<username>\AppData\Roaming\.minecraft\libraries\com\paulscode\libraryjavasound\20101123\libraryjavasound-20101123.jar;
C:\Users\<username>\AppData\Roaming\.minecraft\libraries\com\paulscode\librarylwjglopenal\20100824\librarylwjglopenal-20100824.jar;
C:\Users\<username>\AppData\Roaming\.minecraft\libraries\com\paulscode\soundsystem\20120107\soundsystem-20120107.jar;
C:\Users\<username>\AppData\Roaming\.minecraft\libraries\io\netty\netty-all\4.0.10.Final\netty-all-4.0.10.Final.jar;
C:\Users\<username>\AppData\Roaming\.minecraft\libraries\com\google\guava\guava\15.0\guava-15.0.jar;
C:\Users\<username>\AppData\Roaming\.minecraft\libraries\org\apache\commons\commons-lang3\3.1\commons-lang3-3.1.jar;
C:\Users\<username>\AppData\Roaming\.minecraft\libraries\commons-io\commons-io\2.4\commons-io-2.4.jar;
C:\Users\<username>\AppData\Roaming\.minecraft\libraries\net\java\jinput\jinput\2.0.5\jinput-2.0.5.jar;
C:\Users\<username>\AppData\Roaming\.minecraft\libraries\net\java\jutils\jutils\1.0.0\jutils-1.0.0.jar;
C:\Users\<username>\AppData\Roaming\.minecraft\libraries\com\google\code\gson\gson\2.2.4\gson-2.2.4.jar;
C:\Users\<username>\AppData\Roaming\.minecraft\libraries\com\mojang\authlib\1.2\authlib-1.2.jar;
C:\Users\<username>\AppData\Roaming\.minecraft\libraries\org\apache\logging\log4j\log4j-api\2.0-beta9\log4j-api-2.0-beta9.jar;
C:\Users\<username>\AppData\Roaming\.minecraft\libraries\org\apache\logging\log4j\log4j-core\2.0-beta9\log4j-core-2.0-beta9.jar;
C:\Users\<username>\AppData\Roaming\.minecraft\libraries\org\lwjgl\lwjgl\lwjgl\2.9.1-nightly-20131120\lwjgl-2.9.1-nightly-20131120.jar;
C:\Users\<username>\AppData\Roaming\.minecraft\libraries\org\lwjgl\lwjgl\lwjgl_util\2.9.1-nightly-20131120\lwjgl_util-2.9.1-nightly-20131120.jar;
C:\Users\<username>\AppData\Roaming\.minecraft\libraries\org\lwjgl\lwjgl\lwjgl-platform\2.9.1-nightly-20131120\lwjgl-platform-2.9.1-nightly-20131120-natives-windows.jar;
C:\Users\<username>\AppData\Roaming\.minecraft\libraries\net\java\jinput\jinput-platform\2.0.5\jinput-platform-2.0.5-natives-windows.jar;
C:\Users\<username>\AppData\Roaming\.minecraft\libraries\tv\twitch\twitch\5.12\twitch-5.12.jar;
C:\Users\<username>\AppData\Roaming\.minecraft\libraries\tv\twitch\twitch-platform\5.12\twitch-platform-5.12-natives-windows-64.jar;
C:\Users\<username>\AppData\Roaming\.minecraft\libraries\tv\twitch\twitch-external-platform\4.5\twitch-external-platform-4.5-natives-windows-64.jar;
net.minecraft.client.main.Main
--username=<your username>
--accessToken <your accesstoken>
--version 1.7.4
--gameDir C:\Users\<username>\AppData\Roaming\.minecraft
--assetsDir C:\Users\<username>\AppData\Roaming\.minecraft\assets
--userProperties {}
--uuid <your uuid>
You can also find out how to get the uuid, session token, and so on on in the same namespace in the link above , or HERE.
This might help:
http://s3.amazonaws.com/Minecraft.Download/versions/1.6.4/1.6.4.json
The link format works for all minecraft versions so you can compare the information and check what has changed.
Be also aware that the Minecraft authentication system has changed. (I think you have to use the new system since 1.7 but it might apply for 1.6 too)
Edit:
You also might want to decompile the official launcher (I did that for my own launcher) provides some useful information about how stuff works.