Re: code within libraries vs code within same project

From: melinda (melinda_at_discussions.microsoft.com)
Date: 02/25/05


Date: Fri, 25 Feb 2005 10:43:03 -0800

sorry for so many posts, but I still have one question....
Is this a bug in System.Diagnostics.StackTrace?
I call
System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace(2, true);
//at this point st.FrameCount is 4, although only 3 have filenames (All
frames that
//appear that are part of the .exe display properly, but the one's that are
part of
//the .dll do not appear to have all the info, particularly filename.
System.Diagnostics.StackFrame sf = st.GetFrame(0);
//now sf is the one without a filename, it's null, it happens to be the
first frame that is part of the dll.
sf.GetFileName(); // this throws an exception, becasue filename is null.

First off, why is filename not there? I'm building with debug on and not
optimized.
Second off, why is filename null? This seems like a bug, but I'm not an
expert on what's considered a bug.

"Ignacio Machin ( .NET/ C# MVP )" wrote:

> Hi,
>
> I bet your problem has nothing to do with the fact the type is in a dll,
> most probably it's cause you are using some resource particular to the .exe
> that is not accesible to the dll.
> Are you using any Environment, AppSetting or something like that?
>
> Take a look at the null object , in the Exception.StackTrace you will get
> the line number of the error.
>
> if this do not help just post the code
>
> cheers,
>
> --
> Ignacio Machin,
> ignacio.machin AT dot.state.fl.us
> Florida Department Of Transportation
>
> "melinda" <melinda@discussions.microsoft.com> wrote in message
> news:D7A96F15-5954-47AC-B86E-FD21854C1FB1@microsoft.com...
> > What are some possible reasons for this:
> >
> > I call a static method from a class within my assembly...works fine.
> > I call the same static method after it has been compiled into a different
> > assembly and referenced to my project....does't work. Give's me a
> > "Object
> > not set to an instance...".
> >
> > What are some possible reasons for this? I'm just giving the assembly a
> > strong name, compiling it into a dll and adding it as a reference into my
> > project. Why would this work any differently?
>
>
>



Relevant Pages

  • Re: Memory increasing even when in debug-break
    ... another test machine that is running the app under .Net 1.1 is still ... I'm left wondering whether this bug is even related. ... leak occurs in a process that uses Corperfmonext.dll in the .NET Framework ... to do this whole DLL injection thing for apps that query performance data... ...
    (microsoft.public.vsnet.debugging)
  • Re: Some compatibility issues using STL.
    ... What is the advantage of using a vector for the memory allocation? ... FileName is a utility class that stores the drive, path, name and ext of a filename which allows for easy and safe modification of either these parts. ... WINUTILITY_EXPORT is defined as _declspec(dllexport) i the DLL project and as _declspecfor all users of the DLL. ... then heap corruption is expected if you allocate memory in one DLL/EXE and free it elsewhere. ...
    (microsoft.public.vc.stl)
  • Problem with locales in unloaded DLLs
    ... We are making a plugin (DLL) for some application. ... locale crash") didn't come up with something. ... this bug. ... I'm Schobi at suespammers dot org ...
    (microsoft.public.dotnet.languages.vc)
  • Problem with locales in unloaded DLLs
    ... We are making a plugin (DLL) for some application. ... locale crash") didn't come up with something. ... this bug. ... I'm Schobi at suespammers dot org ...
    (microsoft.public.vc.stl)
  • Re: c code reusability
    ... Program X uses DLL Y. DLL Y is "improved", and a bug is introduced. ... At least one OS I use has deprecated static linking for all ... It's way easier to fix a library bug with a patch ...
    (comp.lang.c)