I have a silverlight application elevated trust deployed at my company and some errors I get the "debugging resource strings are unavailable" I was wondering if there was any way currently for silverlight 4 to get the full error message without installing the developer version of silverlight on every single machine.
Thanks in advance
Hope this article helps u... Check this
By default, the full exception strings are not enabled in silverlight. You need to enable it in the slr.dll.managed_manifest file.
I would wrap the code giving the exception in try/catch brackets and then use MessageBox.Show to display the error message;
try
{
// Code that crashes
}
catch (Exception e)
{
MessageBox.Show("Error: " + e);
}
Exception also contains some other useful variables.
Hope this helps.
Related
Iam created a WPF Application in framework 4.5 and deployed as ClickOnce Application.
It is for Connecting and write the QuickBooks(3rd party) Software.
The Application is working fine On every system except few systems.
In few systems it is got crashed even if I am keeping the Application as idle.(After Connecting to the 3rd party software).
I don't know what is exactly happens with only few systems.
After crashing it is immediately Opens the JIT.
In that the following call stack i had
4036a9ae() Unknown
[Frames below may be incorrect and/or missing]
kernel32.dll!#BaseThreadInitThunk#12() Unknown
ntdll.dll!__RtlUserThreadStart() Unknown
ntdll.dll!__RtlUserThreadStart#8() Unknown
I have added all exception handling mechanisms includes catching Dispatcher Unhandled exception and Unhandled exceptions. even though it is not catch any of the exceptions.
Can anyone tell me, how to resolve this issue or How to find out the exact reason behind it?
The last two weeks I am trying to resolve it.
My event Logs shows below
Exception code: 0xc00001a5
Fault offset: 0x00056738
Faulting process id: 0xe9c
Goto project properties of your solution and set the application build start type to Console Application, then in the Constructor of MainWindow use try catch something like below
public MainWindow()
{
try{
InitializeComponent();
//you remaining code
}
catch(Exception ex){
Console.Out.Writeline(ex.Message);
}
}
then deploy on the pcs where your app crashes...and see in the console whats the error
I have a function which should check, if COM is registered in the system. It may happen, that COM is registered, but dll file is missing - in this case function also should return false. MessageBoxes are only for debugging purposes:
public bool IsCOMInstalled(string name)
{
try
{
MessageBox.Show("?");
var obj = Activator.CreateInstance(Type.GetTypeFromProgID(name));
MessageBox.Show("!");
return true;
}
catch (Exception e)
{
MessageBox.Show(e.Message);
return false;
}
}
On Windows XP and 7 above works fine. On Windows Server 2008, exception is not handled. Application crashes right after showing "?".
Why is that? How can I make my application handle an exception...?
I think its the problem with your framework of windows.
when Framework fail to handle exception that time CLR fail to run further. means your code totally destroys the functionality of CLR.
check the system requirements of windows 8 as maintained in Note of following link.
i found the system requirements for windows 8 to run this.
http://msdn.microsoft.com/en-us/library/8z6watww.aspx
I have a console application written in C#. This application runs as automation to test a web service.
Flow:
Log in to network share (impersonate user)
copy mp3 file to local disc
convert mp3 to wav
downsample
trim wave
extract some useful data from wav
send http request
delete local files
write out some stuff to tsv
The application will run great for several hours (usually takes about 24 hours to complete the test). but every once and a while I will get this message: "The application has stopped working. I have been running this is VS 2012 in debug mode so, I can see what line throws any error. problem is, that I have not been able to catch the line (or method) that is throwing the error. I originally thought that the Domain controller was causing this issue due to power settings.
How can I capture exactly what error is bubbling its way up the stack?
Does all that run in a loop of some kind? Or on a timer?
Perhaps put a try-catch around the body of the loop or the method that runs all your code, add a logging framework of your choice (log4net or nlog seem good) and then in the catch log the exception. Most logging frameworks allow you to include the exception and will include stacktrace, etc.
Putting debug logging throughout the process can also help to narrow down where it's happening.
You can go to the Event Viewer on the operating system the console application is running on and then click on "Application". Event viewer logs and displays all exceptions thrown on any application running on the operating system.
try
{
// your code
}
catch (Exception e)
{
System.IO.File.WriteAllText(#"Z:\err.txt", e.ToString());
}
Note that access to windows drives are denied for non administrators so replace Z: with your choice.
I recommend you using a logging framework.
I use log4net in almost all applications. Its very simple to use and configure.
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
try
{
// do whatever
}
catch(Exception ex)
{
// Log an error with an exception
log.Error("Exception thrown", ex);
}
By using these kind of libraries you can get your log data output to file, database or even written to the windows event-viewer for instance.
It looks like the exception code you are getting happens when you try to use something that is already been garbage collected. Are you using anything after it is disposed?
Knowledge Base Article for 0xc0000005
I have created a Windows form application using C# in visual studio 2010 connecting the database in SQL server . After all my development is done i copy the exe file generated in my machine and pasted in another machine and try to execute it but it is not working .
i can see the process started in task manager but it was closed after 5 seconds . I even tried creating the setup for this application and installed in that machine still i am facing the same issue .
But in my machine it is working perfectly in the both the ways . can any one help me in finding where i went wrong .
Thanks in advance
As you don't provide the error, the answers and comments you are getting are educated guesses.
You should check the event viewer for errors...
This will let you learn what is going on. If you can't fix it, add this info to your question.
As you are not posting exception message, probably you re not properly catching exceptions. Just to be sure surround your main function in a Try/Catch.
In Catch, write some code to dump message exception into a file, or even better use Log4Net. For simplicity just add some code to write to a file now. Something like:
static void Main()
{
try
{
//Your code
}
catch (Exception ex)
{
//Write ex.Message to a file
using (StreamWriter outfile = new StreamWriter(#".\error.txt"))
{
outfile.Write(ex.Message.ToString());
}
}
}
PS: If it is a console application you can survive with Console.Write
Perhaps you have some referenced assemblies that you did not copy along with the application itself.
OR, the connection string is not valid when run from that other machine (if you worked with a local SQL db, or on a network or whatever and it's not accesible on that other machine)
OR, you don't have rights to run it on that other machine.
I have sample exe say console.exe on "programfiles\myAppFolder" .It serves the purpose of logging the message to eventviewer
EventLog.WriteEntry(sSource, sEvent, EventLogEntryType.Warning, 234);
I need to call this exe on un-install of appcn from NSIS script .However it gives me an error always that "thisappConsole has encountered a problem and needs to close. We are sorry for the inconvenience."
Even browsing to the path "programfiles\myAppFolder\thisappConsole.exe" and manually clicking on it to execute even throws the same error. I do have admin access to m/c.
Can anyone help me with this.
If I put any other simple console app without any additional "using statements". it works fine ..
Press F5.
This will run the programme in the debugger, and you the unhandled exception will be displayed on screen. It will give a exception type, message, and line number.
Sounds to me like your event log application is throwing an unhandled exception, quite ironic considering it is an application for logging events!
I would put my money on it being a permissions issue as the event log needs to access the registry. As a work-around try running your application as an Admin. Would be handy to handle the AppDomain.UnhandledException event and log the exception.
you could try
Try
{
your app code here
}
Catch (Exception ex)
{
//Logg ex.ToString()
}
Try
{
your code here
}
Catch (Exception ex)
{
ex.message="";
}
finally
{}
Check to be sure you have the same version of the .Net framework installed on that machine, and also any referenced .dll's are in the same folder as the .exe.