// Token: 0x06001817 RID: 6167 RVA: 0x0004D47F File Offset: 0x0004B67F private void SetMessageField() { if (this._message == null) { this._message = FileLoadException.FormatFileLoadExceptionMessage(this._fileName, base.HResult); } }
public void GetFusionLog_Pass () { FileLoadException fle = new FileLoadException ("message", "filename"); Assert.AreEqual ("message", fle.Message, "Message"); Assert.AreEqual ("filename", fle.FileName, "FileName"); Assert.IsNull (fle.FusionLog, "FusionLog"); // note: ToString doesn't work in this case }
private void SetMessageField() { if (this._message != null) { return; } this._message = FileLoadException.FormatFileLoadExceptionMessage(this._fileName, this.HResult); }
public void NoRestriction () { FileLoadException fle = new FileLoadException ("message", "filename", new FileLoadException ("inner message", "inner filename")); Assert.AreEqual ("message", fle.Message, "Message"); Assert.AreEqual ("filename", fle.FileName, "FileName"); Assert.IsNull (fle.FusionLog, "FusionLog"); Assert.IsNotNull (fle.ToString (), "ToString"); }
internal static string FormatFileLoadExceptionMessage(string fileName, int hResult) { string format = null; FileLoadException.GetFileLoadExceptionMessage(hResult, JitHelpers.GetStringHandleOnStack(ref format)); string arg = null; FileLoadException.GetMessageForHR(hResult, JitHelpers.GetStringHandleOnStack(ref arg)); return(string.Format(CultureInfo.CurrentCulture, format, fileName, arg)); }
internal static string FormatFileLoadExceptionMessage(string fileName, int hResult) { string s1 = (string)null; FileLoadException.GetFileLoadExceptionMessage(hResult, JitHelpers.GetStringHandleOnStack(ref s1)); string s2 = (string)null; FileLoadException.GetMessageForHR(hResult, JitHelpers.GetStringHandleOnStack(ref s2)); return(string.Format((IFormatProvider)CultureInfo.CurrentCulture, s1, (object)fileName, (object)s2)); }
public void FullRestriction () { FileLoadException fle = new FileLoadException ("message", "filename", new FileLoadException ("inner message", "inner filename")); Assert.AreEqual ("message", fle.Message, "Message"); Assert.AreEqual ("filename", fle.FileName, "FileName"); Assert.IsNull (fle.FusionLog, "FusionLog"); // ToString doesn't work in this case and strangely throws a FileLoadException Assert.IsNotNull (fle.ToString (), "ToString"); }
private void SetMessageField() { if (base._message == null) { if ((this._fileName == null) && (base.HResult == -2146233088)) { base._message = Environment.GetResourceString("IO.FileNotFound"); } else if (this._fileName != null) { base._message = FileLoadException.FormatFileLoadExceptionMessage(this._fileName, base.HResult); } } }
private void SetMessageField() { if (_message == null) { if ((FileName == null) && (HResult == System.HResults.COR_E_EXCEPTION)) { _message = SR.IO_FileNotFound; } else if (FileName != null) { _message = FileLoadException.FormatFileLoadExceptionMessage(FileName, HResult); } } }
private void SetMessageField() { if (_message == null) { if ((_fileName == null) && (HResult == System.__HResults.COR_E_EXCEPTION)) { _message = Environment.GetResourceString("IO.FileNotFound"); } else if (_fileName != null) { _message = FileLoadException.FormatFileLoadExceptionMessage(_fileName, HResult); } } }
private void SetMessageField() { if (this._message != null) { return; } if (this._fileName == null && this.HResult == -2146233088) { this._message = Environment.GetResourceString("IO.FileNotFound"); } else { if (this._fileName == null) { return; } this._message = FileLoadException.FormatFileLoadExceptionMessage(this._fileName, this.HResult); } }
/// <summary> /// The 'Load' method is used as the name implies to load the records from the flat file into a generic /// container that can be used to view data at ease and to perform changes amongst the data records if necessary /// and future use. /// </summary> /// <param name="func"></param> /// <returns>Returns the Message Struct that indicates whether extracting the data from the file was /// succesful or not</returns> public void Load(loadFunc func) { lock (lockObj) { if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } if (File.Exists(path + "\\" + file)) { FileLoadException fLE =null; using (StreamReader fileIn = new StreamReader(path + "\\" + file)) { while (!fileIn.EndOfStream) { try { func(fileIn.ReadLine()); } catch (EmployeeException eE) { fLE = new FileLoadException("Found invalid employee data in Database. Records will be removed on next save"); } } } if (fLE != null) { throw fLE; } } else { File.Create(path + "\\" + file); } } }
public void ErrorMessageShownWhenLoadAssemblyFromThrowsFileLoadException() { IAddInTree addInTree = MockRepository.GenerateStrictMock<IAddInTree>(); DerivedRuntime runtime = new DerivedRuntime(addInTree, "Missing.dll", String.Empty); FileLoadException ex = new FileLoadException("Test"); runtime.LoadAssemblyFromExceptionToThrow = ex; runtime.Load(); string expectedErrorMessageStart = "The addin 'Missing.dll' could not be loaded:\n" + "System.IO.FileLoadException: Test"; string errorMessage = runtime.ErrorMessageDisplayed; Assert.IsTrue(errorMessage.StartsWith(expectedErrorMessageStart), errorMessage); }
public void GetFusionLog_Fail_ControlPolicy () { FileLoadException fle = new FileLoadException (); Assert.IsNull (fle.FusionLog, "FusionLog"); // we don't have to throw the exception to have FusionLog // informations restricted (even if there could be no // data in this state). }
public void GetFusionLog_Fail_ControlEvidence () { FileLoadException fle = new FileLoadException (); Assert.IsNull (fle.FusionLog, "FusionLog"); }
public void ErrorMessageShownWhenLoadAssemblyFromThrowsFileLoadException() { List<AddIn> addIns = new List<AddIn>(); DerivedRuntime runtime = new DerivedRuntime("Missing.dll", String.Empty, addIns); FileLoadException ex = new FileLoadException("Test"); runtime.LoadAssemblyFromExceptionToThrow = ex; runtime.Load(); string expectedErrorMessageStart = "The addin 'Missing.dll' could not be loaded:\n" + "System.IO.FileLoadException: Test"; string errorMessage = runtime.ErrorMessageDisplayed; Assert.IsTrue(errorMessage.StartsWith(expectedErrorMessageStart), errorMessage); }