Rolf, Shall I file a bug?
Switched to MonoDevelop 2.8.6.5 and MonoTouch 5.2.5 today, but problem still present... Guido On Tue, Feb 14, 2012 at 07:00, Guido Van Hoecke <[email protected]> wrote: > Hi Rolf, > > Nope, I get 'in <fllename unknown>:0' > > Guido > > On Tue, Feb 14, 2012 at 00:06, Rolf Bjarne Kvinge <[email protected]> wrote: >> Hi, >> >> Do you get file name & line numbers in stack traces, like for this code? >> >> try { >> throw new Exception (); >> } catch (Exception e) { >> Console.WriteLine (e.StackTrace); >> } >> >> Rolf >> >> On Mon, Feb 13, 2012 at 9:05 PM, Guido Van Hoecke <[email protected]> wrote: >>> Hi, >>> >>> I have following CallerInfo routine: >>> >>> /// <summary> >>> /// Returns a string with following components: >>> /// 1) The current time as a "yyyy-MM-dd HH:mm:ss.fff " string >>> /// 2) A string with following caller format S:M(L) where >>> /// S = Source filename, >>> /// M = Method name, >>> /// L = Line number in source file. >>> /// </summary> >>> /// <param name="frameNr">The calling frame nr.</param> >>> /// <returns>The callerinfo (see above)</returns> >>> private static string CallerInfo (int frameNr = 2) >>> { >>> var stackTrace = new StackTrace (true); >>> if (stackTrace.FrameCount <= frameNr) { >>> return string.Format ("No frame {0}, only {1} available!", >>> frameNr, stackTrace.FrameCount); >>> } >>> var stackFrame = stackTrace.GetFrame (frameNr); >>> var fileName = stackFrame.GetFileName(); >>> fileName = fileName == null ? "?file?" >>> : fileName.Substring (1 + fileName.LastIndexOf ('/')); >>> var method = stackFrame.GetMethod().Name; >>> var linenr = stackFrame.GetFileLineNumber (); >>> return string.Format ("{0}:{1}({2})", fileName, method, linenr); >>> } >>> >>> When run (in debug mode) in a .net application this routine performs as >>> intended and returns strings à la: 'MySourceFile:MyMethod(123)' when >>> reporting about a call at line 123 in MyMethod of MySourceFile.cs >>> >>> However, when run when debugging a monotouch app on the simulator, only >>> the method name is known, neither the filename nor the linenr seem to be >>> available. This would produce following string (for the above test >>> case): '?file?:MyMethod(0)' >>> >>> Shouldn't the StackFrame have the same structure and content with >>> monotouch's mono runtime and the .net mono run time? >>> >>> I don't really understand why it isn't behaving as expected in a >>> monotouch application that is being debugged. >>> >>> Or is there somewhere some option to be set so that FileName and >>> FileLineNumber would be included? >>> >>> Anybody any pointers? >>> >>> >>> Guido >>> >>> -- >>> Ehrman's Commentary: >>> 1. Things will get worse before they get better. >>> 2. Who said things would get better? >>> >>> http://vanhoecke.org ... and go2 places! >>> _______________________________________________ >>> MonoTouch mailing list >>> [email protected] >>> http://lists.ximian.com/mailman/listinfo/monotouch _______________________________________________ MonoTouch mailing list [email protected] http://lists.ximian.com/mailman/listinfo/monotouch
