-
Notifications
You must be signed in to change notification settings - Fork 636
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add CER wrapper #12831
add CER wrapper #12831
Conversation
</upi_element> | ||
</upi_element> | ||
</UpiValueRetrieval> | ||
</UpiDllConfig> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to find a way to generate this file at compile time (only the version information will change..). Could not figure out a way yet..(t4 templates are giving me a hard time)
As a last resort I can generate this file at runtime (when a crash is caught)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is it generated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is generated manually (following the CER guidelines)
It should correspond to every new release of dynamo (from the UPI configs)
private static extern uint GetCurrentThreadId(); | ||
|
||
[DllImport("dbghelp.dll")] | ||
private static extern bool MiniDumpWriteDump( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this from a reference somewhere? Maybe link would be good?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dbghelp.dll is part of windows.
https://docs.microsoft.com/en-us/windows/win32/debug/dbghelp-versions
The docs do say that older versions might exist, but I think MiniDumpWriteDump
is a very old API and it is probably on all versions of the dll.
It is also available as a redistributable if we want to have it published with Dynamo (but I think it will bring in other dependencies too)
var upiConfigFilePath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "upiconfig.xml"); | ||
|
||
var cerArgs = $"/UPITOKEN {upiConfigFilePath} /DMP {miniDumpFilePath} /APPXML \"{appConfig}\" {extras}"; | ||
Process.Start(new ProcessStartInfo(CerToolLocation, cerArgs)).WaitForExit(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there any reason to WaitForExit()? Can't Dynamo just close and CER will go off and do its work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it can. I wanted CER to behave the same as our inhouse crash report window (which is modal)
|
|
@pinzart90 the linked UI does not mention the upload including files/settings specifically, I guess it does mention the in memory program ... |
</upi_element> | ||
</upi_element> | ||
</UpiValueRetrieval> | ||
</UpiDllConfig> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is it generated?
// Show the unhandled exception dialog so user can copy the | ||
// crash details and report the crash if she chooses to. | ||
viewModel.Model.OnRequestsCrashPrompt(null, | ||
new CrashPromptArgs(e)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So now it's going to be the CER reporting dialog or our crash dialog in Dynamo - one or the other? Can it be both? In other words will the information we see in the standard Dynamo crash dialog be useful to show when the CER tool is enabled as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say one or the other.
CER collects everything that the old crash dialog was collecting, and more...
I suppose we'll need to update PIA for Dynamo now that we are collecting a lot more information from users. |
public bool SendLogFile = true; | ||
public bool SendSettingsFile = true; | ||
public bool SendDynFile = true; | ||
public bool SendRecordedCommands = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these flags going to be controlled somewhere (in the CER UI)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These flags are not exposed/controlled by the CER UI.
I added these flags expecting that I will expose the CrashReportTool as a public API for host integrators.
Some might want less to be collected ....
We will 100% need to runt his past legal, but so long as a user actively accepts something we are mostly likely legally covered. Is there a UI I can send on to James Connor @pinzart @mjkkirschner ? |
The .dyn, the settings files and the rest (which may be considered PIA) are only collected if the user clicks |
/// <summary> | ||
/// Struct mapping to MINIDUMP_EXCEPTION_INFORMATION for Win32 API | ||
/// </summary> | ||
[StructLayout(LayoutKind.Sequential, Pack = 4)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe you answered this already, was this pack size documented somewhere or found by trial and error? it appears to make this struct smaller than if the default on an x64 system - I think there would be 4 bytes of padding between the ThreadId
and ExceptionPointers
if the default was used?
I guess this is to make the padding the same between architectures?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main reason is this (from msdn docs):
https://docs.microsoft.com/en-us/cpp/dotnet/how-to-marshal-structures-using-pinvoke?view=msvc-170
there is no relationship between the native and managed version of the two structures other than their data layout. Therefore, it is vital that the managed version contains fields that are the same size and in the same order as the native version. (There is no mechanism for ensuring that the managed and native versions of the structure are equivalent, so incompatibilities will not become apparent until run time. It is the programmer's responsibility to ensure that the two structures have the same data layout.)
Because the members of managed structures are sometimes rearranged for performance purposes, it is necessary to use the [StructLayoutAttribute](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.structlayoutattribute) attribute to indicate that the structure are laid out sequentially. It is also a good idea to explicitly set the structure packing setting to be the same as that used by the native structure. (Although by default, Visual C++ uses an 8-byte structure packing for both managed code.)
I could not find info on how the native structure is packed...but I did find an example of c# pInvoking into the minidump function...and it specified packing with 4 bytes and it seems to work.
Example from here : https://www.pinvoke.net/default.aspx/dbghelp/MiniDumpWriteDump.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default pack size for x64 is 16. This is normally not used by the Win32 apis if they want to keep binary backward compatibility for some reason. The way to figure out what to use is to look in the header files for Win32. So when I look at minidumpapiset.h
I see in the beginning:
#include <pshpack4.h>
and in the end:
#include <poppack.h>
So 4 it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh..I searched for that header on my entire windows folder and program files.
Only now I realize that it was on the x86 program files...Damn
Thanks @sm6srw
Hey @pinzart90 - a couple questions left -
|
This PR adds a CER wrapper in DynamoCoreWpf
It is windows only for now (has UI)
CER is not yet delivered as part of Dynamo. You can only use it if you have Revit, Civil or Robot installed (we can add more)
The CER windows will show up only if you have the
CER
feature flag enabledI only added the minimum amount of information to the CER reports. There seem to be a lot more data that we can send to CER (we can probably enhance it as we go along)
Purpose
https://jira.autodesk.com/browse/DYN-4681
Declarations
Check these if you believe they are true
*.resx
filesRelease Notes
(FILL ME IN) Brief description of the fix / enhancement. Mandatory section
Reviewers
(FILL ME IN) Reviewer 1 (If possible, assign the Reviewer for the PR)
(FILL ME IN, optional) Any additional notes to reviewers or testers.
FYIs
(FILL ME IN, Optional) Names of anyone else you wish to be notified of