當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。