为什么ResourceManager.GetResourceSet在构建后的第一个请求上返回null? (C#)

我正在研究一个用C#(asp.net)构建的大型Web应用程序。 我有一个简单的aspx页面,它为客户端浏览器提供本地化字符串,以便在javascript控件中使用。 为了获得字符串,我执行以下操作:

ResourceManager _resources = new ResourceManager(_pathname, typeof(ARM).Assembly); ResourceSet rs = _resources.GetResourceSet(culture, false, false); //loop through rs and write the keys & values out to the client in plaintext 

这一切都很好,除了在Clean / Build或Rebuild之后立即对页面的第一个请求(如果我只是进行一些更改,然后Build,它工作正常)。 所以在第一个请求时,当我尝试迭代ResourceSet时,我得到一个空引用exception。 但是,如果我在错误之后刷新页面,那么它从那时起就可以正常工作。

有谁知道为什么会这样?

方法GetResourceSet的第二个参数“createIfNotExist”必须为true,它告诉ResourceManager加载ResourceSet(如果尚未加载)。

 ResourceSet rs = _resources.GetResourceSet(culture, true, false);