GetManifestResourceStream() return null value RRS feed

  • Question

  •  Hi ,

     i am using the code to retrive a script data  but unable to retreive any value.there may  be some inconsistency in script but i am not able to find from where i can find the problem.

    Assembly Asm;
                Asm = Assembly.GetExecutingAssembly();
                Stream strm = Asm.GetManifestResourceStream(Asm.GetName().Name + "." + Name);

    please suggest.

    rishi [URL= ]miniclip[/URL], [URL= ]btjunkie[/URL], [URL= ]games[/URL]

    Thursday, October 18, 2012 3:15 PM


  • I guess the name that you pass to the GetManifestResourceStream may not be exactly same.

    You can first verify whether the name is correct by getting all the resource names using Assembly.GetManifestResourceNames method.

    Assembly thisAssembly = Assembly.GetExecutingAssembly ();
    string[] resourceNames = thisAssembly.GetManifestResourceNames ();
    foreach (string resourceName in resourceNames)
      // Do you find your required resource name here?
      Console.Writeline (resourceName);

    Pass the exact name that you find in that foreach loop to your GetManifestResourceStream method.

    A silly question probably: Whether the script file that you are expecting to retrieve from resources is available inside as an embedded resource? I mean that have you set the "Build Action" from the properties of your script file to "Embedded Resource"?
    • Edited by Rajesh_Kannan Thursday, October 18, 2012 6:44 PM
    • Marked as answer by Rishi90 Friday, October 19, 2012 10:46 AM
    Thursday, October 18, 2012 6:40 PM