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


C# ApplicationException.ToString方法代码示例

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


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

示例1: log_an_assembly_failure

        public void log_an_assembly_failure()
        {
            var package = new StubPackage("a");
            var exception = new ApplicationException("didn't work");
            var theFileNameOfTheAssembly = "assembly.dll";
            diagnostics.LogAssemblyFailure(package, theFileNameOfTheAssembly, exception);

            var log = diagnostics.LogFor(package);

            log.Success.ShouldBeFalse();
            log.FullTraceText().Contains(exception.ToString()).ShouldBeTrue();

            log.FullTraceText().ShouldContain("Failed to load assembly at '{0}'".ToFormat(theFileNameOfTheAssembly));
        }
开发者ID:Memmo,项目名称:fubumvc,代码行数:14,代码来源:PackagingDiagnosticsTester.cs

示例2: OnSaveOptions

		/// <summary>
		/// Overrides Package.OnSaveOptions()
		/// Invoked by the Package class when there are options to be saved to the solution file.
		/// </summary>
		/// <param name="key">The name of the option key to save.</param>
		/// <param name="stream">The stream to save the option data to.</param>
		protected override void OnSaveOptions(string key, Stream stream)
		{
			try
			{
				if (0 == string.Compare(key, CommandLineOptionKey))
				{
					Logging.WriteLine("Saving CommandLineEditor options");
					CommandLineEditor.SaveOptions(stream);
				}
				else if (0 == string.Compare(key, BatchBuildSetsOptionKey))
				{
					Logging.WriteLine("Saving BatchBuilder options");
					BatchBuilder.SaveOptions(stream);
				}
			}
			catch (Exception Ex)
			{
				// Couldn't save options
				Exception AppEx = new ApplicationException("OnSaveOptions() failed with key " + key, Ex);
				Logging.WriteLine(AppEx.ToString());
				throw AppEx;
			}
		}
开发者ID:frobro98,项目名称:UnrealSource,代码行数:29,代码来源:UnrealVSPackage.cs

示例3: ComboHandler

		/// Called by combo control to query the text to display or to apply newly-entered text
		private void ComboHandler(object Sender, EventArgs Args)
		{
			try
			{
				var OleArgs = (OleMenuCmdEventArgs)Args;

				string InString = OleArgs.InValue as string;
				if (InString != null)
				{
					// New text set on the combo - set the command line property
					DesiredCommandLine = null;
					CommitCommandLineText(InString);
				}
				else if (OleArgs.OutValue != IntPtr.Zero)
				{
					string EditingString = null;
					if (OleArgs.InValue != null)
					{
						object[] InArray = OleArgs.InValue as object[];
						if (InArray != null && 0 < InArray.Length)
						{
							EditingString = InArray.Last() as string;
						}
					}

					string TextToDisplay = string.Empty;
					if (EditingString != null)
					{
						// The control wants to put EditingString in the box
						TextToDisplay = DesiredCommandLine = EditingString;
					}
					else
					{
						// This is always hit at the end of interaction with the combo
						if (DesiredCommandLine != null)
						{
							TextToDisplay = DesiredCommandLine;
							DesiredCommandLine = null;
							CommitCommandLineText(TextToDisplay);
						}
						else
						{
							TextToDisplay = MakeCommandLineComboText();
						}
					}

					Marshal.GetNativeVariantForObject(TextToDisplay, OleArgs.OutValue);
				}
			}
			catch (Exception ex)
			{
				Exception AppEx = new ApplicationException("CommandLineEditor threw an exception in ComboHandler()", ex);
				Logging.WriteLine(AppEx.ToString());
				throw AppEx;
			}
		}
开发者ID:didixp,项目名称:Ark-Dev-Kit,代码行数:57,代码来源:CommandLineEditor.cs

示例4: CodeBug

 /// <summary>
 /// Throws RuntimeException to indicate failed assertion.
 /// The function never returns and its return type is RuntimeException
 /// only to be able to write <tt>throw EcmaScriptHelper.CodeBug()</tt> if plain
 /// <tt>EcmaScriptHelper.CodeBug()</tt> triggers unreachable code error.
 /// </summary>
 public static ApplicationException CodeBug()
 {
     ApplicationException ex = new ApplicationException ("FAILED ASSERTION");
     Console.Error.WriteLine (ex.ToString ());
     throw ex;
 }
开发者ID:arifbudiman,项目名称:TridionMinifier,代码行数:12,代码来源:Context.cs

示例5: SaveOptions

		/// <summary>
		/// Called from the package class when there are options to be written to the solution file.
		/// </summary>
		/// <param name="Stream">The stream to save the option data to.</param>
		public void SaveOptions(Stream Stream)
		{
			try
			{
				using (BinaryWriter Writer = new BinaryWriter(Stream))
				{
					Writer.Write(_BuildJobSetsCollection.Count);
					foreach (var Set in _BuildJobSetsCollection)
					{
						Writer.Write(Set.Name);
						Writer.Write(Set.BuildJobs.Count);
						foreach (var Job in Set.BuildJobs)
						{
							Writer.Write(Job.Project.FullName);
							Writer.Write(Job.Project.Name);
							Writer.Write(Job.Config);
							Writer.Write(Job.Platform);
							Writer.Write(Enum.GetName(typeof(BuildJob.BuildJobType), Job.JobType) ?? "INVALIDJOBTYPE");
						}
					}
				}
			}
			catch (Exception ex)
			{
				Exception AppEx = new ApplicationException("BatchBuilder failed to save options to .suo", ex);
				Logging.WriteLine(AppEx.ToString());
				throw AppEx;
			}
		}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:33,代码来源:BatchBuilderToolControl.xaml.cs

示例6: LoadOptions

		/// <summary>
		/// Called from the package class when there are options to be read out of the solution file.
		/// </summary>
		/// <param name="Stream">The stream to load the option data from.</param>
		public void LoadOptions(Stream Stream)
		{
			try
			{
				_BuildJobSetsCollection.Clear();

				using (BinaryReader Reader = new BinaryReader(Stream))
				{
					int SetCount = Reader.ReadInt32();

					for (int SetIdx = 0; SetIdx < SetCount; SetIdx++)
					{
						BuildJobSet LoadedSet = new BuildJobSet();
						LoadedSet.Name = Reader.ReadString();
						int JobCount = Reader.ReadInt32();
						for (int JobIdx = 0; JobIdx < JobCount; JobIdx++)
						{
							Utils.SafeProjectReference ProjectRef = new Utils.SafeProjectReference { FullName = Reader.ReadString(), Name = Reader.ReadString() };

							string Config = Reader.ReadString();
							string Platform = Reader.ReadString();
							BuildJob.BuildJobType JobType;

							if (Enum.TryParse(Reader.ReadString(), out JobType))
							{
								LoadedSet.BuildJobs.Add(new BuildJob(ProjectRef, Config, Platform, JobType));
							}
						}
						_BuildJobSetsCollection.Add(LoadedSet);
					}
				}

				EnsureDefaultBuildJobSet();
				if (SetCombo.SelectedItem == null)
				{
					SetCombo.SelectedItem = _BuildJobSetsCollection[0];
				}
			}
			catch (Exception ex)
			{
				Exception AppEx = new ApplicationException("BatchBuilder failed to load options from .suo", ex);
				Logging.WriteLine(AppEx.ToString());
				throw AppEx;
			}
		}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:49,代码来源:BatchBuilderToolControl.xaml.cs


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