Microsoft Diagnostics Runtime crash.dmp analysis (C#) -
i'm trying read in crash.dmp using functionality in microsoft.diagnostics.runtime .net componenet (also known clrmd).
i have crash.dmp in known location (in string called pathtofile) that's not issue. rest of code looks this.
datatarget datatarget = datatarget.loadcrashdump(pathtofile); clrinfo clrinfo = datatarget.clrversions[0]; string daclocation = clrinfo.trygetdaclocation();
when testing code, following error in command window:
error processing directory: system.argumentoutofrangeexception. index out of range. must non-negative , less size of collection. parameter name: index.
i'm assuming it's clrversions[0] bit can't life of me pin down.
any appreciated.
current status when running following command (which fails)
clrruntime rt = datatarget.createruntime("path\to\mscordawks.dll");
i receive following error in cmd mismatched architecture between process , dac
cheers
anyone?
i having same issue reading dump file generated on same computer. there 2 problems, first bitness (should have been 64, running in 32) , second harder problem proper dll not located. fix second problem created method tries of named dlls can find:
private static clrruntime getruntime(datatarget target) { clrinfo version = target.clrversions[0]; string daclocation = version.trygetdaclocation(); // if don't have dac installed, use long-name dac in same folder. if (!string.isnullorempty(daclocation)) daclocation = version.dacinfo.filename; try // try 1 should { return target.createruntime(daclocation); } catch (exception e) { } // can't find 1 should be, try'em string filename = "mscordacwks.dll"; string[] searchlocations = new[] { @"c:\windows\microsoft.net\", @"c:\windows\winsxs\" }; foreach (string searchlocation in searchlocations) { foreach (string file in directory.getfiles(searchlocation, filename, searchoption.alldirectories)) { try { return target.createruntime(file); } catch (exception e) { } } } throw new exception("no found valid runtimes"); }
Comments
Post a Comment