In the .NET framework, the method Assembly -> Get Manifest Resource Stream has a gotcha that could take some time to figure out why is not working as intented. I was working in a piece of code (show below), and the GetManifestResourceStream always returned NULL exception error. Even though the file was there…

C# example:

public XmlTextReader GetSyntaxModeFile(SyntaxMode syntaxMode)
{
    Assembly assembly = typeof(SyntaxMode).Assembly;
    var stream = assembly.GetManifestResourceStream(“ICSharpCode.TextEditor.Resources.” + syntaxMode.FileName);
    if(stream == null)
        throw new Exception(“The resource “+syntaxMode.FileName+” was not loaded properly.”);
    return new XmlTextReader(stream);
}

Solution:

The GetManifestResourceStream method will always returns NULL if the resource ‘built action‘ property is not set to ‘embedded resource

After setting this property with all the needed files assembly.GetManifestResourceStream starts returning the corrent stream instead of NULL