Good point. Of course, I live with that condition now as well, where the
not the right fix. :)
"Greg Young" wrote:
> There is a bigger problem which is not being mentioned about the
> Assembly.Load method ..
>
> If you are loading theses assemblies into your own appdomain, there is no
> way to unload them after! The memory for the assembly will still be used by
> the asp.net worker process .. using cecil this memory will not be lost as
> you are working directly with the assembly (i.e. only dealing with the
> metadata)
>
> Cheers,
>
> Greg Young
> MVP - C#
>
> "Dale" <dale0973@nospam.nospam> wrote in message
> news:2FECBBA1-E0D5-4865-B055-1F8AF18F6402@microsoft.com...
> > Thanks for the tip. I just checked out Cecil and loaded it in a project
> > so I
> > could view it in the object browser. It definitely has the functionality
> > I
> > need and the nice thing is I don't have to reinvent the wheel.
> >
> > I am going to try Stephen Gennard's suggestion of using
> > Assembly.Load(Byte[]) first because that will work with the existing
> > application pretty easily but it is nice to have the Cecil suggestion in
> > the
> > wings.
> >
> > Thanks to all for helping me solve this problem.
> >
> > Dale
> > --
> > Dale Preston
> > MCAD C#
> > MCSE, MCDBA
> >
> >
> > "Greg Young" wrote:
> >
> >>
http://www.mono-project.com/Cecil should help you out.
> >>
> >> Cheers,
> >>
> >> Greg Young
> >> MVP - C#
> >> "Dale" <dale0973@nospam.nospam> wrote in message
> >> news:D13CA1E4-EDB2-4D8E-B23F-428969A43739@microsoft.com...
> >> >I am working on a web application that is used for migrating other web
> >> > applications to production. The application currently loads each dll
> >> > in
> >> > the
> >> > target application using Assembly.LoadFile and then calls
> >> > GetCustomAttributes on the assembly to ensure it was not built in debug
> >> > mode.
> >> > The problem with this approach is that it leaves the assembly loaded
> >> > until
> >> > the worker process times out or is otherwise unloaded.
> >> >
> >> > I need to be able to determine if the assembly was built in debug mode
> >> > without loading the assembly. Because we, by policy, build Release
> >> > mode
> >> > with "Generate Debugging Information" set to true, we have a .pdb file
> >> > even
> >> > in release so checking for the existence of the .pdb is not an option.
> >> >
> >> > I assume the approach would mean to open the file as a binary file,
> >> > parse
> >> > the appropriate metadata elements, and then close the file. Any ideas
> >> > on
> >> > how
> >> > to do read the metadata like this or on alternative methods to
> >> > accomplish
> >> > the
> >> > goal that leaves the target assembly files closed and unloaded?
> >> >
> >> >
> >> > Thanks in advance,
> >> >
> >> > Dale
> >> > --
> >> > Dale Preston
> >> > MCAD C#
> >> > MCSE, MCDBA
> >>
> >>
> >>
>
>