@@ -177,10 +177,11 @@ internal static bool ShowCrashErrorReportWindow(DynamoViewModel viewModel, Crash
177
177
178
178
DynamoModel model = viewModel ? . Model ;
179
179
180
- string cerToolDir = ! string . IsNullOrEmpty ( model . CERLocation ) ?
181
- model . CERLocation : FindCERToolInInstallLocations ( ) ;
180
+ string cerToolDir = ! string . IsNullOrEmpty ( model ? . CERLocation ) ?
181
+ model ? . CERLocation : FindCERToolInInstallLocations ( ) ;
182
+
183
+ var cerToolPath = ! string . IsNullOrEmpty ( cerToolDir ) ? Path . Combine ( cerToolDir , CERDllName ) : string . Empty ;
182
184
183
- var cerToolPath = Path . Combine ( cerToolDir , CERDllName ) ;
184
185
if ( string . IsNullOrEmpty ( cerToolPath ) || ! File . Exists ( cerToolPath ) )
185
186
{
186
187
model ? . Logger ? . LogError ( $ "The CER tool was not found at location { cerToolPath } ") ;
@@ -199,30 +200,57 @@ internal static bool ShowCrashErrorReportWindow(DynamoViewModel viewModel, Crash
199
200
{
200
201
string logFile = Path . Combine ( cerDir . FullName , "DynamoLog.log" ) ;
201
202
202
- File . Copy ( model . Logger . LogPath , logFile ) ;
203
- // might be usefull to dump all loaded Packages into
204
- // the log at this point.
205
- filesToSend . Add ( logFile ) ;
203
+ if ( File . Exists ( model . Logger . LogPath ) )
204
+ {
205
+ File . Copy ( model . Logger . LogPath , logFile ) ;
206
+ filesToSend . Add ( logFile ) ;
207
+ }
208
+ else
209
+ {
210
+ model ? . Logger ? . LogError ( $ "Failed to add DynamoLog.log to CER with the following error : { model . Logger . LogPath } Not Found") ;
211
+ }
206
212
}
207
213
208
214
if ( args . SendSettingsFile && model != null )
209
215
{
210
216
string settingsFile = Path . Combine ( cerDir . FullName , "DynamoSettings.xml" ) ;
211
- File . Copy ( model . PathManager . PreferenceFilePath , settingsFile ) ;
212
217
213
- filesToSend . Add ( settingsFile ) ;
218
+ if ( File . Exists ( model . PathManager . PreferenceFilePath ) )
219
+ {
220
+ File . Copy ( model . PathManager . PreferenceFilePath , settingsFile ) ;
221
+
222
+ filesToSend . Add ( settingsFile ) ;
223
+ }
224
+ else
225
+ {
226
+ model ? . Logger ? . LogError ( $ "Failed to add DynamoSettings.xml to CER with the following error : { model . PathManager . PreferenceFilePath } Not Found") ;
227
+ }
214
228
}
215
229
216
230
if ( args . HasDetails ( ) )
217
231
{
218
232
var stackTracePath = Path . Combine ( cerDir . FullName , "StackTrace.log" ) ;
219
- File . WriteAllText ( stackTracePath , args . Details ) ;
220
- filesToSend . Add ( stackTracePath ) ;
233
+ try
234
+ {
235
+ File . WriteAllText ( stackTracePath , args . Details ) ;
236
+ filesToSend . Add ( stackTracePath ) ;
237
+ }
238
+ catch ( Exception ex )
239
+ {
240
+ model ? . Logger ? . LogError ( $ "Failed to add StackTrace.log to CER with the following error : { ex . Message } ") ;
241
+ }
221
242
}
222
243
223
244
if ( args . SendRecordedCommands && viewModel != null )
224
245
{
225
- filesToSend . Add ( viewModel . DumpRecordedCommands ( ) ) ;
246
+ try
247
+ {
248
+ filesToSend . Add ( viewModel . DumpRecordedCommands ( ) ) ;
249
+ }
250
+ catch ( Exception ex )
251
+ {
252
+ model ? . Logger ? . LogError ( $ "Failed to add recorded commands to CER with the following error : { ex . Message } ") ;
253
+ }
226
254
}
227
255
228
256
string appConfig = "" ;
@@ -234,9 +262,23 @@ internal static bool ShowCrashErrorReportWindow(DynamoViewModel viewModel, Crash
234
262
$ "session_start_count=\" 0\" session_clean_close_count=\" 0\" current_session_length=\" 0\" />";
235
263
}
236
264
237
- string dynName = viewModel ? . Model . CurrentWorkspace . Name ;
265
+ string dynName = model ? . CurrentWorkspace . Name ;
266
+
267
+ var miniDumpFilePath = string . Empty ;
268
+ try
269
+ {
270
+ miniDumpFilePath = CreateMiniDumpFile ( cerDir . FullName ) ;
271
+ }
272
+ catch ( Exception ex )
273
+ {
274
+ model ? . Logger ? . LogError ( $ "Failed to generate minidump file for CER due to the following error : { ex . Message } ") ;
275
+ }
276
+
277
+ if ( string . IsNullOrEmpty ( miniDumpFilePath ) )
278
+ {
279
+ return false ;
280
+ }
238
281
239
- var miniDumpFilePath = CreateMiniDumpFile ( cerDir . FullName ) ;
240
282
var upiConfigFilePath = Path . Combine ( Path . GetDirectoryName ( Assembly . GetExecutingAssembly ( ) . Location ) , "upiconfig.xml" ) ;
241
283
242
284
using ( var cerDLL = new CerDLL ( cerToolPath ) )
0 commit comments