|
Hi,
I have C# application with WCF service though I have proper Try.. Catch block in my application very rare when my application crashes or something that sort it didn't get into Catch Block and simply pop-up .Net debug window. What is the best way to configure my application to handle all the run time exception? Is there any configuration need to be set at Web/Application configuration etc ?
Thanks
|
|
|
|
|
satsumatable wrote: when my application crashes or something that sort it didn't get into Catch Block and simply pop-up .Net debug window.
When you're debugging with VS environment then I think it will always notify you with pop-up block when error occurs though you've specified try..catch..
satsumatable wrote: What is the best way to configure my application to handle all the run time exception?
It's handling Exception itself, for the need it invented.
satsumatable wrote: Is there any configuration need to be set at Web/Application configuration etc ?
Nothing just use Try..Catch block and Log the error catched by exception handling. That's it.
|
|
|
|
|
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
}
Will this resolve ?
|
|
|
|
|
See THIS[^] article for more detailed information.
|
|
|
|
|
Sounds like you've got first chance exception-handling switched on in Visual Studio. Visual studio normally breaks on an unhandled exception, but you can change a setting so it happens 'first chance' on all exceptions, so even though you've got an exception block (which will still work just fine if you hit F5) it will break there none-the-less.
Have a look in your Debug->Exceptions menu.
Regards,
Rob Philpott.
|
|
|
|
|
satsumatable wrote: What is the best way to configure my application to handle all the run time exception?
You can't catch all runtime exceptions. If your application causes a stack overflow, or you run out of memory, the application is terminated immediately without going to the exception handler.
|
|
|
|
|
satsumatable wrote: have C# application with WCF service though I have proper Try.. Catch block in my application very rare when my application crashes or something that sort it didn't get into Catch Block and simply pop-up .Net debug window
There are three cases that can cause that.
1. Exceptions that cannot be caught. There are three of those, out of memory, stack overflow and an odd ball one that I can't remember and probably has nothing to do with your problem.
2. Exceptions that exits a thread block excluding the specific thread specific ones like interrupt. Any such exception will cause an application exit. The way to prevent this is to insure that all threads have try/catch at the top level. This includes asynchronous methods. And that might be the cause of your problem.
3. Unmanaged code and/or net errors. The second of these would be outside your control. The first means that you are using unmanaged code so presumably you would be aware of that.
Also note that AppDomain.UnhandledException will NOT prevent an application exit. All it does is provide a place for you to log what the exception was.
|
|
|
|
|
|
Hi,
Do you know some free library for easy and nice printing of documents concerning for example product details?
I know two tools - Crystal Reports, but they are not free
Word templates - but there must be MS Office installed on the machine on which the report will be printed.
I need something similar, not necessarily editable in a template way but providing nice looking prints of customer and product details
Thanks in advance?
|
|
|
|
|
Have you considered PDF? Nearly everyone has a PDF reader installed these days, and they can all print.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
Do an internet search for c# open source reporting.
You will get loads of hits, so get your reading glasses on.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi all,
I am having one header file i.e., .h file in c++ and i want to add it to my c# windows application.
How can i do this ?
Thanks in advance.
|
|
|
|
|
You can't. C# has no concept of a header file. You need to create a class or struct.
Please at least look at some documentation on the language before you try using it.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Add a C++ project to your projects. In the C++ project, create a class implementing the header file's methods and properties, then reference that C++ project from your C# projects. That's a few steps more complicated than we would like to have it, but it is feasible.
|
|
|
|
|
As Mark says, you can't.
You will need to recreate all the functions prototypes and constants in a C# class. Any structures that are used will also need to be recreated. You will need to make use of the contents of the System.Runtime.InteropServices[^] namespace.
You may find www.pinvoke.net[^] useful as most of the Windows things have already been done there.
|
|
|
|
|
You don't and can't use a header file in C#.
One of the advantages of using C# over C++ is precisely the fact that it doesn't use header files.
You can only use C++ header files indirectly in C# by referencing a C++ library,
which allows you to access anything declared as public in the header files
that were compiled into it.
|
|
|
|
|
Use the C preprocessor, but the code had better be valid C#.
|
|
|
|
|
I am new to creating WCF projects as well as windows phone 7.
I created a simple method in WCF which just returns a list of an object.
public List<Sticky> GetSticky()
{
return stickys;
}
I then used it very simply
Sticky[] test = client.GetSticky();
When I import the WCF dll via a service reference into a console app the method acts how it should. When I import the method into a Windows Phone 7 application it become an async method (not sure what this means)and doesnt return a list, it comes up void.
client.GetStickyAsync();
If anyone can help explain what is going on and help me to be a little less confused.
Thanks
|
|
|
|
|
Hi all ,
i need a help that i need to import excel to the sql database.
i saw the examples of doing the same, but the thing is that the columns in the excel will get change dynamically. So i want to do as like in SQL import and Export data doing.
It will create the table with respect to the excel (also we have option to choose our own table and map the columns).Like that i need to create the table with respect to the excel every time when i do import . What method should i use, Please help me.
Thanks in advance.
|
|
|
|
|
It seems as though you want the application to be all things to all people which is sure failure.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Do you have SSIS?
If you had to look that up then you probably don't.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Ha! I had to do that last week!
System.Data.IDataReader dr = db1.ExecuteReader
(
"SELECT * FROM [" + args [ 2 ] + "]"
) ;
db2.CreateTable ( args [ 3 ] , dr ) ;
db2.InsertData ( args [ 3 ] , dr ) ;
I'll leave the rest as an exercise.
|
|
|
|
|
Thanks piebald.. i will try this one... thanks and thank you very much for your time..
|
|
|
|
|
This[^] could help you.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
|
|
|
|
|