0

We Have A C# Application That Runs On Many Client Machines And We Have Very Lines Of Code Like This:

try{exceptionalMethod();}//all type of exceptions may be throw here (system.exception,our business exceptions ,...)
catch{MessageBox.Show("Error");randomMethod();}//we don't have any log here

How We Can Log All CLR First Chance Exceptions In Log File In Production Environment.
Attention: We Can't Install AnyThing On the client's Machine(If We Can, We Use Adplus And Windows Debuggers With Very Simple Configuration File).
But We Can Insert Minimum Changes In Code And Ship New Version.

  • You are asking about logging, not dumps. This code doesn't crash so there are no dumps to collect. Add a proper logging library and add proper logging code instead of popping message boxes. – Panagiotis Kanavos Feb 01 '19 at 08:44
  • @PanagiotisKanavos : We Start Logging But We Have Many Live Clients With This Legacy Codes. Now How We Can Do? – Alireza Khalesi Feb 01 '19 at 08:46
  • 2
    You can use the [AppDomain.FirstChanceException](https://learn.microsoft.com/en-us/dotnet/api/system.appdomain.firstchanceexception?redirectedfrom=MSDN&view=netframework-4.7.2) to inspect/log exceptions before they reach the exception handlers, but you still need to add some code. There's not much else you can do when the code *explicitly* hides the exceptions – Panagiotis Kanavos Feb 01 '19 at 08:53
  • 1
    Going forward you may want to think about using eg Application Insights or NewRelic to collect logs, metrics, events from installations – Panagiotis Kanavos Feb 01 '19 at 08:56
  • @PanagiotisKanavos: AppDomain.FirstChanceException is what I needed. thanks – Alireza Khalesi Feb 01 '19 at 09:02

0 Answers0