none
GetManifestResourceStream returns null in Excel Add In RRS feed

  • Question

  • Hi,

    I have a strange problem. I have an Excel Add In that uses GetManifestResourceStream to get a stream to an xml file.

    I have a log from the following code fragment:

    var stream = callingAssembly.GetManifestResourceStream(resourceName);
      if (Logger.IsDebugEnabled)
         {
    	if (stream != null)
    	  {
    	    Logger.Debug("Opened resource stream for " + resourceName);
    	  }
    	else
    	  {
    	    Logger.Debug("No resource found with the name " + resourceName);
    	}
    }

    Once installed this code fails to read the resource steam on some PCs.

    I have decompiled and the resourceName that I see in the log is an exact match of the one I see embedded in the dll. So it is not one of the standard misstakes and this piece of code has works on other installations for a few years now.

    1. The file is embedded as a resource

    2. The assembly name is correct

    3. The code works on som installations but not all. Verified that the version of the component is the same.

    4. I have decompiled it to check that the resource is there

    5. The code has a fallback that loops over all resources (GetManifestResourceNames) to find a matching "ends with" since this is a general component and people often get the resource names wrong. Unfortunately I have no logs for this call.

    6. The resource is public in the dll

    Why would GetManifestResourceStream return null on some installations of the same Excel Add In? They claim to only have one version installed but I can't verify the issue here since it works on all 3 machines we have tested it on. Could this be becuase of a system set-up / configuration some how?



    Karin, Stockholm

    Monday, November 10, 2014 6:06 AM

All replies

  • Hello Karin,

    > The code works on som installations but not all.

    Could you please be more specific about problematic machines?

    Did you check the required prerequisites before installing your add-in?

    Monday, November 10, 2014 10:18 AM
  • Hi,

    I'm sorry but I don't have that much info on the problematic machines. They are all Windows 7 with Office 2013. But it works on other Windows7 machines. I run Windows 8.1 and Office 2013.

    The required prerequisites is .Net 4.5, full .Net framework - not just the client and parts of ASP.Net. But we have the same requirements in another application that they are running without issues so I don't think that this is the issue. The application works it is just tha the GetManifestResourceStream doesn't.

    I did try to find the source but only found virtual methods. Do know in which class the implementation of this method is?


    Karin, Stockholm

    Thursday, November 13, 2014 5:27 AM