private ReportTreeNode CopyReport(Serialization.Node src, int businessUnitId) { ReportTreeNode dst = null; if (IsAuthorized(src, businessUnitId)) { ReportHandle handle = new ReportHandle(); CopyFields(handle, src); Serialization.ReportReference reference = (Serialization.ReportReference)src.Content.Items[0]; if (reference.ComingSoon) { handle.ComingSoon = true; } else { handle.Report = FindReport(reference.Value, true); } dst = handle; } return(dst); }
/// <exception cref="System.Runtime.InteropServices.COMException"> /// Some failure HRESULTs map to well-defined exceptions, while others do not map /// to a defined exception. If the HRESULT maps to a defined exception, ThrowExceptionForHR /// creates an instance of the exception and throws it. Otherwise, it creates an instance /// of System.Runtime.InteropServices.COMException, initializes the error code field with /// the HRESULT, and throws that exception. When this method is invoked, it attempts to /// retrieve extra information regarding the error by using the unmanaged GetErrorInfo /// function. /// </exception> private static void SetBucketParameter(ReportHandle reportHandle, BucketParameterId bucketParameterId, string value) { HandleHResult(NativeMethods.WerReportSetParameter( reportHandle, bucketParameterId, bucketParameterId.ToString(), value)); }
internal static extern int WerReportAddDump( ReportHandle reportHandle, IntPtr hProcess, IntPtr hThread, DumpType dumpType, IntPtr pExceptionParam, IntPtr dumpCustomOptions, DumpFlags dumpFlags);
private static void SetBucketParameters(ReportHandle reportHandle, Exception uncaughtException) { Exception innerException = uncaughtException; while (innerException.InnerException != null) { innerException = innerException.InnerException; } SetBucketParameter(reportHandle, BucketParameterId.NameOfExe, TruncateExeName(nameOfExe, 20)); SetBucketParameter(reportHandle, BucketParameterId.FileVersionOfSystemManagementAutomation, TruncateBucketParameter(versionOfPowerShellLibraries, 0x10)); SetBucketParameter(reportHandle, BucketParameterId.InnermostExceptionType, TruncateExceptionType(innerException.GetType().FullName, 40)); SetBucketParameter(reportHandle, BucketParameterId.OutermostExceptionType, TruncateExceptionType(uncaughtException.GetType().FullName, 40)); SetBucketParameter(reportHandle, BucketParameterId.DeepestFrame, GetDeepestFrame(uncaughtException, 50)); SetBucketParameter(reportHandle, BucketParameterId.DeepestPowerShellFrame, GetDeepestPowerShellFrame(uncaughtException, 50)); SetBucketParameter(reportHandle, BucketParameterId.ThreadName, TruncateBucketParameter(GetThreadName(), 20)); }
internal static extern int WerReportSubmit( ReportHandle reportHandle, Consent consent, SubmitFlags flags, out SubmitResult result);
internal static extern int WerReportSetParameter( ReportHandle reportHandle, BucketParameterId bucketParameterId, [MarshalAs(UnmanagedType.LPWStr)] string name, [MarshalAs(UnmanagedType.LPWStr)] string value);
internal static extern int WerReportCreate( [MarshalAs(UnmanagedType.LPWStr)] string pwzEventType, ReportType repType, [MarshalAs(UnmanagedType.LPStruct)] ReportInformation reportInformation, out ReportHandle reportHandle);
private static void SetBucketParameter(ReportHandle reportHandle, BucketParameterId bucketParameterId, string value) { HandleHResult(NativeMethods.WerReportSetParameter(reportHandle, bucketParameterId, bucketParameterId.ToString(), value)); }