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.


I have left fusion team. I can still answer questions about fusion and SxS. For feature/change suggestions, you can try Alan Shi, or many of the CLR bloggers.


Thanks for reading.

Comments (16)

  1. Carlos says:

    Obvious question: what are you doing now and will you be blogging it?

  2. junfeng says:

    I work in Windows Live now.

    You can probably tell from my recent articles. I probably will talk about random programming questions.

    I still have a few things wanted to discuss in the assembly binding though. When I get time I will post them.

  3. Some time my GAC folder is empty, it shows 0 files. I normally try few things like closing all instances of visual studio, reset IIS, reset Biztalk(since thats my day job) shut down antivirus etc etc….it works some times…else i need to do a reboot….any idea why this is happening??

    Regards,

    Saravana

  4. Colin Finck says:

    I have a question concerning SxS: I want to use the VC80 CRT on WinPE 2.0.

    How can I do this?

    I already copied the folder, which contains the "msvcm80.dll", "msvcp80.dll" and "msvcr80.dll" files into the WinSxS folder of the WinPE.

    But when I try to start a test application, which is dynamically linked to these files, I get a side-by-side configuration error. A trace with "sxstrace.exe" shows a "Did not find the assembly in WinSxS" error. Do you know what I am doing wrong?

    Statically linked applications work without problems.

    BTW, is there another way to get in contact with you (i.e. by E-Mail) than just this blog?

    Thanks in advance and best regards,

    Colin Finck

  5. junfeng says:

    Saravana,

    I have no idea. Sorry.

    Colin,

    You can’t xcopy files to winsxs directory in Vista, and expect it to work. (when you say WinPE 2.0, I assume it is Vista).

    You should look into using the API to install it.

    http://msdn2.microsoft.com/en-us/library/aa376204.aspx

  6. JohnL says:

    Have a question about the ResourceResolve event.

    Our product is using satellite assemblies for localization.  To get localized strings we call ResourceManager.GetString().

    The tricky part is we’re trying to deploy the resource files on-demand from a server.  When the code hits the GetString call, the ResourceResolve event is triggered.

    My event handler code downloads the file, installs it into the GAC and returns an Assembly object.  But the GetString call asserts with a MissingManifestResourceException.

    But, because I installed the file into the GAC, the next time I run the resources work fine.

    There must be a difference between me returning an Assembly oibject and when it gets the resources from the GAC.  Any ideas?

    Thanks

  7. junfeng says:

    This may have been caused by the caching of assembly binding failures in .Net framework 2.0.

    http://blogs.msdn.com/junfeng/archive/2004/07/22/190813.aspx

  8. John L says:

    I think i have a theory.

    The assembly I’m returning has a culture of ‘en’, but the threadCulture is set to en-US.

    If the ResourceResolve event asks for an en-US assembly and I return an assembly with an ‘en’ culture, will that cause it to fail?

  9. john.carneiro says:

    I am having a Fusion API issue when using the CreateAssemblyCache() and InstallAssembly() calls descibed

    described in the online doc:

    http://www.grimes.demon.co.uk/workshops/fusWSTen.htm

    Here is the main  doc:

    http://www.grimes.demon.co.uk/workshops/fusionWS.htm

    In this the .NET 2.0 C# code snippet.

    I am basically installing an assembly in the GAC using the fusion API

    under an app domain. After successfully installing it I try

    loading it using the full name (an.FullName = "Waters.Scheduler.Resources", Version=1.0.0.0, Culture=neutral, PublicKeyToken=9248a9e9e65bdbea")

    and it fails to load

    a = Assembly.Load(an.FullName);

    Interestingly, when I exit my program and restart it then finds it ok.

    Does the fusion API somehow need be refreshed somehow?

    Does the fusion API need to be called from another app domain for the

    Assembly.Load(an.FullName);

    to recognize the GAC assembly?

    I was thinking a seerate process then may need to install the assemblies in the GAC, then load

    them on the main process.

    Or is this a bug or I am using the API the wrong way?

    The AssemblyCache.InstallAssembly() method calls the fusion API via some wrapper code arround the API.

    Thanks for any help given.

    //***********************************************************

    // If assembly is signed, then add it to the GAC

    //***********************************************************

    if (localAName.GetPublicKeyToken() != null && localAName.GetPublicKeyToken().Length != 0)

    {

       // Impersonate EverestUser account

       tokenHandle = IntPtr.Zero;

       dupeTokenHandle = IntPtr.Zero;

       // Call LogonUser to obtain a handle to an access token.

       bool returnValue = LogonUser(adminUserName, null, adminPassword,

           LOGON32_LOGON_SERVICE, LOGON32_PROVIDER_DEFAULT,

           ref tokenHandle);

       // Check return value

       if (!returnValue)

       {

           throw new DeploymentException("LogonUserFailed");

       }

       else

       {

           // Impersonate everest service user

           try

           {

               bool retVal = DuplicateToken(tokenHandle, SecurityImpersonation, ref dupeTokenHandle);

           }

           catch (Exception e)

           {

               throw new DeploymentException("DupTokenLogonFailed", e.Message);

           }

           // The token that is passed to the following constructor must

           // be a primary token in order to use it for impersonation.

           WindowsIdentity newId = new WindowsIdentity(dupeTokenHandle);

           WindowsImpersonationContext impersonatedUser = newId.Impersonate();

           try

           {

               // Install assembly into the GAC

               // The force flag forces the reinstall of an assembly regardless of any

               //    existing assembly with the same assembly name

               AssemblyCache.InstallAssembly(localFileName, null, AssemblyCommitFlags.Force);

           }

           catch (Exception e)

           {

               throw new DeploymentException("GacInstallFailed", e.Message, localFileName);

           }

           finally

           {

               // Stop impersonating the user.

               impersonatedUser.Undo();

           }

       }

    }

    // delete the local copy, since we only need it in the GAC

    File.Delete(localFileName);

    // this fails to find the assembly in the GAC

    Assembly a = Assembly.Load(an.FullName);      

  10. junfeng says:

    John L,

    I think it is possible. But I am not the best person to answer your question, as I don’t know much about resource loading. Try to ask in BCLTeam’s blog.

  11. junfeng says:

    john.carneiro

    I haven’t tried the scenario you described. There is no caching for assembly in GAC. So your scenario in theory should work.

    If you want me to guess, I will probably say it is caused by the same caching binding failure breaking change above.

    In any case, fusion binding log is your friend.

  12. Sean M says:

    On my newly installed Vista Home Premium setup, I appear to be missing the folder for Microsoft.Windows.Common-Controls in the WinSxS folder. Is this intentional? I cannot embed a manifest referencing the version 6.x common controls in Visual Studio 2005 without it. Is there a way to fix this?

  13. junfeng says:

    Sean,

    Common Control is still in Winsxs. It is used by every UI component in VIsta.

  14. spacattac says:

    Your descriptions on DEVPATH were helpful, but I’m still having a problem.  I have a VS2005 solution where my NUnit project does just fine finding the Assemblies in my DEVPATH but my Web Site project fails to find them.

    Any thoughts or suggestions?

    Thanks,

    Lane

  15. junfeng says:

    spacattac,

    I believe it is a bug in .Net framework 2.0, and there is a QFE available.

    Please contact Microsoft Product Support Service for more information.

  16. spacattac says:

    junfeng,

    You were absolutely correct.  You have to go through Support and there is a QFE – if anybody else needs it have them refer to KB Article Number(s): 931338

    Thanks!

    Lane