Questions and suggestions


I set the comment limit to 90 days. As a result, the original post for questions and suggestions has expired. This one is just to re-enable that.


Please post any questions or suggestions in this blog.


Questions and suggestions should related to Fusion and CLR Loader.


For example:


Things in Fusion/CLR that you don’t understand, or you feel confusing and requires more detailed explanation.
Things that you feel awkward in the current implementation and you want to see a change in the future.
etc.


Remember, I don’t do diagnose. Use newsgroup, MSDN forum, PSS for that.


Thanks for reading.

Comments (11)

  1. derekgreer says:

    Hey Junfeng. My team is using a C# interface to the fusion APIs which is based upon the code available at http://www.codeproject.com/csharp/GacApi.asp. This code is similar to the examples you posted in http://blogs.msdn.com/junfeng/articles/229648.aspx.

    I ran into the need to obtain the assembly path within the GAC and am using the QueryAssemblyInfo() method, but am unfamiliar with the intricacies of COM marshalling. In the API we’re using, ASSEMBLY_INFO.pszCurrentAssemblyPathBuf is defined as a string. I’ve been able to get the path populated when calling QueryAssemblyInfo() by assigning pszCurrentAssemblyPathBuf to a new String(char[1024]) and setting cchBuf to 1024, but am concerned with whether this is a safe approach or not. It appears that the memory location of pszCurrentAssemblyPathBuf is being written to as opposed to being assigned a new string. I’ve drawn this conclusion based on the fact that when I assign pszCurrentAssemblyPathBuf to a String.Empty then I run into memory errors. Since string is immutable I’m not sure whether it is safe for the QueryAssemblyInfo() method to be writing to this area of memory.

    I noticed that in your C++ API you are assigning pszCurrentAssemblyPathBuf to the address of a WCAR [] array. What would you consider to be the correct approach if using a C# API wrapper? Thanks.

    Derek Greer

    dgreer@fedex.com

  2. derekgreer says:

    It appears you are doing the same thing in the String QueryAssemblyInfo(String assemblyName) method of your C# version. So, you feel it is safe for the COM method to write to the memory location of the aInfo.currentAssemblyPath string?

    Derek Greer

    dgreer@fedex.com

  3. In my own limited test it is working.

    You can also try StringBuilder if you feel uncomfortable with String.

  4. derekgreer says:

    Yes, I did try this but apparently there is some limitation to putting a StringBuilder in a structure.

    Derek Greer

    dgreer@fedex.com

  5. Anonymous says:

    This probably isn’t the sort of thing you’re looking for, but I’d be interested to know how to load an IE-hosted (OBJECT tag) managed control from a CAB. There’s no problem loading dependent DLLs from CABs, with lines like this in the app.config:

    <dependentAssembly>

    <assemblyIdentity name="myDLLname"/>

    <codeBase href="myDLLfile.cab"/>

    </dependentAssembly>

    (one CAB per DLL)

    But there doesn’t seem to be a way to reference a DLL in a CAB directly from HTML; for example this doesn’t work:

    <object id="myID" classid="http:somepath/myDLL.cab#myDLLname.myControlName"></object>

    If there’s currently no way to do this, it would be very a nice change for a future release.

    Happy New Year

    (and, in advance, Happy Chinese New Year!)

    Max C

  6. Sorry Max, I can’t help you on this. Maybe try the MSDN forums or newsgroup.

    Happy new year!

  7. Anonymous says:

    My program is using your GAC API code to install files into the GAC.

    But my program needs to run with any level of user permission, e.g. Guest.

    I used CAS to give my strong-named app Full Trust, but I still can’t install into the GAC when I run as anyone other than Admin.

    Is there a permission set in CAS that I can use that will allow my app to install into the GAC?  Or is Admin the only user able to install into the GAC?

    The only other work around I have is to create a service user with Admin privilages and switch to that user before calling your GAC API code.  But this is kinda crude and people don’t like setting up special users on their machine.

    Any other suggestions would be greatly appreciated.

    John L

  8. ksaravan says:

    I am trying to write a clr host in atl using .net 2.0 hosting interfaces. i have implemented IHostAssemblyStore::ProvideAssembly method. I have two assemblies A and B.A references B and calls into some methods of it. when ProvideAssembly is called for A and B and i return the IStream* for them, it returns the error code 0x80131040(The located assembly’s manifest does not match the referenced assembly). I have both A and B in the same folder as the executable. Why it is not able to use the B assembly IStream* and returns this error?. Any help on this would be appreciated.

  9. Did you check fusion binding log?

  10. Anonymous says:

    Hi,

       Do you have a reference to an article which explains how ddls are loaded in

    .net ? I’m particulary interested in finding out how a dll and its dependents

    are loaded during a pinvoke call.

    Thanks !

    Bart