4

We run a commercial silverlight application. When we upgrade our site in IIS some of our users need to clear out their browser history to get the latest updates.

This is silly as you can imagine.

If they don't clear out their browser history some of the users get this,

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; InfoPath.2; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30729; OfficeLiveConnector.1.5; OfficeLivePatch.1.3; .NET4.0C; .NET4.0E; BRI/2)

Timestamp: Thu, 16 Jun 2011 02:41:49 UTC

Message: Unhandled Error in Silverlight Application Unable to retrieve the module type Car.CarList.InitModule, Car.CarList, Version=1.0.123.17153 from the loaded assemblies.  You may need to specify a more fully-qualified type name.   at Microsoft.Practices.Composite.Modularity.ModuleInitializer.HandleModuleInitializationError(ModuleInfo moduleInfo, String assemblyName, Exception exception)

UPDATE: I am starting to understand the issue. Look at the fiddler output,

/ClientBin/Main.xap?ignore-20/06/2011%209:30:19%20a.m.
/ClientBin/CarList.xap

The last-write filedate of the Silverlight Application XAP file has been added to the Main.xap file like explained here,

http://codeblog.larsholm.net/2010/02/avoid-incorrect-caching-of-silverlight-xap-file/

BUT the error above relates to the Car.CarList module which is in a different XAP file.

The problem is that PRISM causes the second 'module' to be loaded CarList.xap, so I am not sure how to add the required query string.

peter
  • 13,009
  • 22
  • 82
  • 142
  • I think this is a problem due to using FireFox. The question http://stackoverflow.com/questions/307709/how-do-you-force-firefox-to-not-cache-or-re-download-a-silverlight-xap-file may provide some help for you. – Jehof Jun 19 '11 at 21:46
  • I have updated my post above. The problem relates to a work around that has been applied to our main XAP file, but hasn't been applied to our other XAP files (we use PRISM to modularise our XAP files). – peter Jun 19 '11 at 22:13
  • Does this problem also occure, when you use IE? – Jehof Jun 19 '11 at 22:31
  • Actually I would guess that 95%+ of our users are using IE, so I would have to say yes IE. – peter Jun 19 '11 at 22:52
  • [This solution](https://stackoverflow.com/a/57458713/1219280) has been working consistently for me – Veverke Sep 12 '19 at 08:34

1 Answers1

2

OK, this definitely solved it.

My module catalog loading looked like this,

protected override IModuleCatalog GetModuleCatalog()
{
    var CarListModule = new ModuleInfo()
    {
        ModuleName = "CarList",
        ModuleType = "Car.CarList.InitModule, Car.CarList, Version=1.0.0.0",
        Ref = "CarList.xap",
        InitializationMode = InitializationMode.OnDemand,
    };
    // blah
}

I changed it to this,

protected override IModuleCatalog GetModuleCatalog()
{
    var CarListModule = new ModuleInfo()
    {
        ModuleName = "CarList",
        ModuleType = "Car.CarList.InitModule, Car.CarList, Version=1.0.0.0",
        Ref = "CarList.xap?Version=1.0.0.0",
        InitializationMode = InitializationMode.OnDemand,
    };
    // blah
}

The query string will be different for each release thus forcing it to load the XAP file and not use the cached version.

Our build server finds the text Version=1.0.0.0 above and substitutes the real versions numbers. This includes the version number in the ModuleType text. To correspond the build server also sets the version number in the actual modules to match.

peter
  • 13,009
  • 22
  • 82
  • 142
  • Have to wait another 24 hours before I can accept the answer. Will do then. – peter Jun 20 '11 at 21:34
  • @Peter - Am I right in assuming that the version number in `ModuleType` on the query string and in the assembly all have to match? – ChrisF Jul 04 '11 at 14:17
  • The ModuleType version number would have to match the version number of the actual assembly. The query string version number doesn't necessarily have to match because it doesn't directly get used. But all of the version numbers would have to change at the same time. I keep them all the same because it makes more sense. – peter Jul 04 '11 at 22:59