Example #1
0
		/// <summary> When we've just received any FaultEvent from the player, this
		/// function gets called.  If a getter/setter is currently executing,
		/// we'll save the fault for someone to get later by calling
		/// endGetterSetter().  Otherwise, normal code execution is taking
		/// place, so we'll add the event to the event queue.
		/// </summary>
		private void  handleFaultEvent(FaultEvent faultEvent)
		{
			if (m_inGetterSetter)
			{
				if (m_faultEventDuringGetterSetter == null)
				// only save the first fault
				{
					// save the event away so that when someone later calls
					// endGetterSetter(), we can return the fault that
					// occurred
					m_faultEventDuringGetterSetter = faultEvent;
				}
			}
			else
			{
				// regular code is running; so post the event to the
				// event queue which the client debugger will see
				addEvent(faultEvent);
			}
		}
Example #2
0
		/// <summary> Informs us that a getter or setter is no longer executing, and
		/// returns the fault, if any, which occurred while the getter/
		/// setter was executing.
		/// </summary>
		public virtual FaultEvent endGetterSetter()
		{
			m_inGetterSetter = false;
			FaultEvent e = m_faultEventDuringGetterSetter;
			m_faultEventDuringGetterSetter = null;
			return e;
		}
Example #3
0
		/// <summary> Tell us that a getter or setter is about to be executed.  If a
		/// FaultEvent comes in while a getter or setter is executing, it
		/// is not added to the event queue in the normal way -- instead,
		/// it is saved, and is returned when endGetterSetter() is called.
		/// </summary>
		public virtual void  beginGetterSetter()
		{
			m_inGetterSetter = true;
			m_faultEventDuringGetterSetter = null;
		}
Example #4
0
		// pretty print a fault statement to the console
		internal virtual void dumpFaultLine(FaultEvent e)
		{
			System.Text.StringBuilder sb = new System.Text.StringBuilder();
			// use a slightly different format for ConsoleErrorFaults
			if (e is ConsoleErrorFault)
			{
				sb.Append(TextHelper.GetString("Info.LinePrefixWhenDisplayingConsoleError")); //$NON-NLS-1$
				sb.Append(' ');
				sb.Append(e.information);
			}
			else
			{
				String name = e.name();
                sb.Append(TextHelper.GetString("Info.LinePrefixWhenDisplayingFault")); //$NON-NLS-1$
				sb.Append(' ');
				sb.Append(name);
				if (e.information != null && e.information.Length > 0)
				{
                    sb.Append(TextHelper.GetString("Info.InformationAboutFault")); //$NON-NLS-1$
					sb.Append(e.information);
				}
			}
			TraceManager.AddAsync(sb.ToString(), 3);
		}
Example #5
0
		/// <summary> We have received a fault and are possibly suspended at this point.
		/// We need to look at our fault table and determine what do.
		/// </summary>
		/// <returns> true if we resumed execution
		/// </returns>
		internal virtual bool handleFault(FaultEvent e)
		{
			// lookup what we need to do
			bool requestResume = false;
			String name = e.name();
			bool stop = true;
			bool print = true;
			try
			{
				print = m_faultTable.isSet(name, "print"); //$NON-NLS-1$
				stop = m_faultTable.isSet(name, "stop"); //$NON-NLS-1$
			}
			catch (System.NullReferenceException npe)
			{
				if (Trace.error)
				{
					System.Collections.IDictionary args = new System.Collections.Hashtable();
					args["faultName"] = name; //$NON-NLS-1$
					Trace.trace(LocalizationManager.getLocalizedTextString("faultHasNoTableEntry", args)); //$NON-NLS-1$
                    Console.Error.Write(npe.StackTrace);
                    Console.Error.Flush();
                }
			}
			
			// should we stop?
			if (!stop)
				requestResume = true;
			
			if (print)
				dumpFaultLine(e);
			
			return requestResume;
		}
Example #6
0
		// pretty print a fault statement to the console
		internal virtual void  dumpFaultLine(FaultEvent e)
		{
			System.Text.StringBuilder sb = new System.Text.StringBuilder();
			
			// use a slightly different format for ConsoleErrorFaults
			if (e is ConsoleErrorFault)
			{
				sb.Append(LocalizationManager.getLocalizedTextString("linePrefixWhenDisplayingConsoleError")); //$NON-NLS-1$
				sb.Append(' ');
				sb.Append(e.information);
			}
			else
			{
				String name = e.name();
				sb.Append(LocalizationManager.getLocalizedTextString("linePrefixWhenDisplayingFault")); //$NON-NLS-1$
				sb.Append(' ');
				sb.Append(name);
				if (e.information != null && e.information.Length > 0)
				{
					sb.Append(LocalizationManager.getLocalizedTextString("informationAboutFault")); //$NON-NLS-1$
					sb.Append(e.information);
				}
			}
			output(sb.ToString());
		}