当前位置: 首页>>代码示例>>C#>>正文


C# Logger.?.WriteTextBlock方法代码示例

本文整理汇总了C#中Logger.?.WriteTextBlock方法的典型用法代码示例。如果您正苦于以下问题:C# Logger.?.WriteTextBlock方法的具体用法?C# Logger.?.WriteTextBlock怎么用?C# Logger.?.WriteTextBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Logger的用法示例。


在下文中一共展示了Logger.?.WriteTextBlock方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BeforeCatch

        /// <summary>
        /// Exception filter function used to report exceptions to telemetry. This **ALWAYS** returns 'true'.
        /// </summary>
        /// <param name="currentException">The current exception which is about to be caught.</param>
        /// <param name="logger">For logging messages</param>
        /// <param name="reportOnlyCorrupting">If true, only corrupting exceptions are reported</param>
        /// <returns>true</returns>
        public static bool BeforeCatch(Exception currentException, Logger logger, bool reportOnlyCorrupting)
        {
            if (reportOnlyCorrupting && !IsCorruptingException(currentException))
            {
                return true; // ignore non-corrupting exceptions
            }

            try
            {
                HostTelemetry.ReportCurrentException(currentException, "Microsoft.MIDebugEngine");

                logger?.WriteLine("EXCEPTION: " + currentException.GetType());
                logger?.WriteTextBlock("EXCEPTION: ", currentException.StackTrace);
            }
            catch
            {
                // If anything goes wrong, ignore it. We want to report the original exception, not a telemetry problem
            }

            return true;
        }
开发者ID:olizit,项目名称:MIEngine,代码行数:28,代码来源:ExceptionHelper.cs

示例2: GetInstance

        public static LaunchOptions GetInstance(HostConfigurationStore configStore, string exePath, string args, string dir, string options, bool noDebug, IDeviceAppLauncherEventCallback eventCallback, TargetEngine targetEngine, Logger logger)
        {
            if (string.IsNullOrWhiteSpace(exePath))
                throw new ArgumentNullException("exePath");

            if (string.IsNullOrWhiteSpace(options))
                throw new InvalidLaunchOptionsException(MICoreResources.Error_StringIsNullOrEmpty);

            logger?.WriteTextBlock("LaunchOptions", options);

            LaunchOptions launchOptions = null;
            Guid clsidLauncher = Guid.Empty;
            object launcher = null;
            object launcherXmlOptions = null;

            try
            {
                XmlSerializer serializer;
                using (XmlReader reader = OpenXml(options))
                {
                    switch (reader.LocalName)
                    {
                        case "LocalLaunchOptions":
                            {
                                serializer = GetXmlSerializer(typeof(Xml.LaunchOptions.LocalLaunchOptions));
                                var xmlLaunchOptions = (Xml.LaunchOptions.LocalLaunchOptions)Deserialize(serializer, reader);
                                launchOptions = LocalLaunchOptions.CreateFromXml(xmlLaunchOptions);
                                launchOptions.BaseOptions = xmlLaunchOptions;
                            }
                            break;

                        case "PipeLaunchOptions":
                            {
                                serializer = GetXmlSerializer(typeof(Xml.LaunchOptions.PipeLaunchOptions));
                                var xmlLaunchOptions = (Xml.LaunchOptions.PipeLaunchOptions)Deserialize(serializer, reader);
                                launchOptions = PipeLaunchOptions.CreateFromXml(xmlLaunchOptions);
                                launchOptions.BaseOptions = xmlLaunchOptions;
                            }
                            break;

                        case "TcpLaunchOptions":
                            {
                                serializer = GetXmlSerializer(typeof(Xml.LaunchOptions.TcpLaunchOptions));
                                var xmlLaunchOptions = (Xml.LaunchOptions.TcpLaunchOptions)Deserialize(serializer, reader);
                                launchOptions = TcpLaunchOptions.CreateFromXml(xmlLaunchOptions);
                                launchOptions.BaseOptions = xmlLaunchOptions;
                            }
                            break;

                        case "IOSLaunchOptions":
                            {
                                serializer = GetXmlSerializer(typeof(IOSLaunchOptions));
                                launcherXmlOptions = Deserialize(serializer, reader);
                                clsidLauncher = new Guid("316783D1-1824-4847-B3D3-FB048960EDCF");
                            }
                            break;

                        case "AndroidLaunchOptions":
                            {
                                serializer = GetXmlSerializer(typeof(AndroidLaunchOptions));
                                launcherXmlOptions = Deserialize(serializer, reader);
                                clsidLauncher = new Guid("C9A403DA-D3AA-4632-A572-E81FF6301E9B");
                            }
                            break;

                        case "SSHLaunchOptions":
                            {
                                serializer = GetXmlSerializer(typeof(SSHLaunchOptions));
                                launcherXmlOptions = Deserialize(serializer, reader);
                                clsidLauncher = new Guid("7E3052B2-FB42-4E38-B22C-1FD281BD4413");
                            }
                            break;

                        default:
                            {
                                launcher = configStore?.GetCustomLauncher(reader.LocalName);
                                if (launcher == null)
                                {
                                    throw new XmlException(string.Format(CultureInfo.CurrentCulture, MICoreResources.Error_UnknownXmlElement, reader.LocalName));
                                }
                                if (launcher as IPlatformAppLauncher == null)
                                {
                                    throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, MICoreResources.Error_LauncherNotFound, reader.LocalName));
                                }
                                var deviceAppLauncher = (IPlatformAppLauncherSerializer)launcher;
                                if (deviceAppLauncher == null)
                                {
                                    throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, MICoreResources.Error_LauncherSerializerNotFound, clsidLauncher.ToString("B")));
                                }
                                serializer = deviceAppLauncher.GetXmlSerializer(reader.LocalName);
                                launcherXmlOptions = Deserialize(serializer, reader);
                            }
                            break;
                    }

                    // Read any remaining bits of XML to catch other errors
                    while (reader.NodeType != XmlNodeType.None)
                        reader.Read();
                }
            }
//.........这里部分代码省略.........
开发者ID:rajkumar42,项目名称:MIEngine,代码行数:101,代码来源:LaunchOptions.cs


注:本文中的Logger.?.WriteTextBlock方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。