Note that there are some explanatory texts on larger screens.

plurals
  1. POSystem.ArgumentNullException in ResourceManager.GetString internals
    primarykey
    data
    text
    <p>My code:</p> <pre><code>System.Resources.ResourceManager resourceManager = GetResourceManager(); string str = resourceManager.GetString("delete", new CultureInfo(1033)); </code></pre> <p>In current project compiled under .NET 2.0 everything works as excepted. Variable <em>str</em> contains resource string for LCID 1033 - <strong>Delete</strong>, this is ok.</p> <p>We are now upgrading to .NET 4.0, recompiled project under target framework .NET 4.0. Now compiled as .NET 4.0 assemblies, it throws exception <strong>System.ArgumentNullException</strong> with message <strong>Value cannot be null.</strong>.Stack trace:</p> <pre><code> at System.Threading.Monitor.Enter(Object obj) at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo requestedCulture, Boolean createIfNotExists, Boolean tryParents, StackCrawlMark&amp; stackMark) at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents) at System.Resources.ResourceManager.GetString(String name, CultureInfo culture) </code></pre> <p>Interesting here is stacktrace, where it points to internal framework method in <strong>ResourceManager.InternalGetResourceSet</strong> which causes to call <strong>Monitor.Enter</strong> with null object. But i call method <em>GetString</em> with not null parameters <em>GetString("delete", new CultureInfo(1033))</em>.</p> <p>This bug seems to be similar to <a href="https://stackoverflow.com/questions/1655182/system-argumentnullexception-in-system-threading-monitor-enter">System.ArgumentNullException in System.Threading.Monitor.Enter</a>. Maybe some bug in Monitor.Enter, or something else?</p> <p>Update: When i look in debugger at object <code>resourceManager.ResourceSets.Items[2].Value.Table["delete"]</code> then it contains string value "Delete". property Items[2] here pointing to LCID 1033. This means that resource manager already contains localized string for resource key <em>delete</em> in language <em>1033</em>. Does anybody knows where can be error?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload