Dave.NET

Hi,

I'm getting a HResult return of 0x806D0005 from the above method and I can not find any documentation that defines what the error code means... Can someone from Microsoft fill in the blanks here for me...

Thanks

Dave.Net



Re: Building Development and Diagnostic Tools for .Net Help ... ISymUnmanagedBinder2::GetReaderForFile2(...) returning 0x806D0005

Dave.NET

Hi,

Never mind... even tho I didn't figure out what the error code really meant... I did work around this error.

I am writing a linkng utility that reads and merges several assemblies into one and also handles merging the .pdb files as well (remaping method tokens, Standalone Sig Tokens for variables, etc). I found that after reading and processing several .pdb files, I would start getting the above error from the binder... I'm guessing it has something to do with resource consumption ... Anyway, the fix is to use the ISymUnmanagedDispose.Destroy() method on the ISymUnmanagedReader when you are done with it. It is not enough to just use Marshal.ReleaseComObject(reader) ... you also have to call Destroy(). The documentation is rather scant here... so I just took a guess that the ISymUnmanagedDispose interface was implemented on the reader ... and it was ....

Hope this helps others working with the ISymUnmanagedxxxx interfaces.

Dave.Net





Re: Building Development and Diagnostic Tools for .Net Help ... ISymUnmanagedBinder2::GetReaderForFile2(...) returning 0x806D0005

Rick Byers - MSFT

Interesting, thanks for the follow-up Dave.

For future reference, 0x806D0005 is E_PDB_NOT_FOUND from the DIA SDK (defined in dia2.idl). DiaSymReader is built on top of the DIA SDK for reading PDB files. For example, see the docs here: http://msdn2.microsoft.com/en-us/library/12kk9t39(VS.80).aspx. Typically you'd get this error when a matching PDB file cannot be found for the specified module using the specified search path. However, the docs do indicate that you might get it for other sorts of failures to open the PDB file.

I'm also willing to believe that this error might get returned for other errors involving resource exhaustion if there are too many active reader instances, but that does seem a little strange. For future reference, what was the rough order to the number of instances you had created Eg., did it start failing after around 10, or 1000 instances I believe calling Destroy shouldn't be strictly necessary, and long as you're sure to have COM-interop release ALL outstanding references. This may involve calling Marshal.FinalReleaseComObject on the reader, and possibly also on any other objects created from the reader (ISymUnmanagedMethod, etc.) which could be holding references on the reader themselves. Explicit COM lifetime management like this can be a hassle with COM-interop, which is usually why convenience Dispose methods like this are provided (which release most resources but don't delete the COM object or lower it's refcount). Using a Dispose method like this when it's available rather than trying to get COM interop to release all references is a good idea.

Rick





Re: Building Development and Diagnostic Tools for .Net Help ... ISymUnmanagedBinder2::GetReaderForFile2(...) returning 0x806D0005

Dave.NET

Hi Rick,

Thanks for the reference (dia2.idl, etc)... I'm sure it will come in handy down the road.

I'm not 100% sure on the exact number of .pdb's I had read (ie. instances created) before it started failing... but it had to be close to 1000. Certainly in the high 100's

I tried to track down and ensure I was releasing all COM-interop references to ISymUnmanaged* instances.. but I guess I could have been missing one or two somewhere along the way...

Oh well, the Destroy() method works like a champ :-) ... I'm able to run thru over 11,000 assembies/pdb's and link/merge them successfully without any resource problems.

Could you answer some questions on how to update an existing .pdb file using the ISymUnmangedWriter interface:

1. I see there is a boolean argument( fFullBuild) to the Initialize() method which allows one to tell the writer to treat the init as a "Incremental Build" ... Is this the mechanism to use to get the writer to allow updates ...

2. I want to be able to update the .pdb file to coorespond to changes made to the assembly. Specifically the method tokens have changed in the assembly.. can I just use RemapToken() to do that

3. Likewise for each method, the standalone signature tokens for its local variables have changed in the assembly... but nothing else has changed for the method (i.e Scopes, Seq Points, etc) ... Is there a way to update the local variables standalone signatures for a method in the .pdb file

4. Some methods may have completely changed... so I'd like to be able to rewrite/replace those... can i just use the writers methods( OpenMethod(), OpenScope(), etc) and overwrite the methods existing scopes, local variables, etc.

Any guidance on how best to go about updating an existing .pdb would be most appreciated ... :-)

Thanks

Dave.NET





Re: Building Development and Diagnostic Tools for .Net Help ... ISymUnmanagedBinder2::GetReaderForFile2(...) returning 0x806D0005

Rick Byers - MSFT

Thanks for the details.

I'm glad to hear it was around 1000 or so - seems a lot more understandable to me than if it had been only a few (eg. may be hitting OS resource limits).

I unfortunately don't know the answers to your questions about updating PDBs off hand. I own the code in the CLR that uses this interface to read and write PDBs, but we never update existing PDBs - just create new ones, so I don't have any experience with what you want to do. I'll track down the people that own this interface and ask them to respond to your questions. It may be that you effectively need to create a new PDB file for changes of this magnitude.

Thanks,

Rick





Re: Building Development and Diagnostic Tools for .Net Help ... ISymUnmanagedBinder2::GetReaderForFile2(...) returning 0x806D0005

waldenk - MSFT

Hi Dave,

Unfortunately, the interface does not provide the ability to rewrite the information in the pdb. An entirely new pdb needs to be created with the new information. Any other information must be transferred to the new one.

Hope this helps,

Walden