ClearScript icon indicating copy to clipboard operation
ClearScript copied to clipboard

Is it possible that the `V8ICUData.ResourceName` constant in some cases is null?

Open Taritsyn opened this issue 3 years ago • 2 comments

Hello!

I was recently informed about a strange error.

According to the description (Value cannot be null. (Parameter 'name')), this error occurs when reading a resource. And it seems that this error began to occur after updating the Microsoft ClearScript.V8 library from version 7.2.1 to 7.3.1.

I have only one explanation for this error: an unsafe V8Proxy.InitializeICU method in some cases cannot get a value of the V8ICUData.ResourceName constant.

Taritsyn avatar Jul 23 '22 18:07 Taritsyn

Hi Andrey,

At first glance, that seems unlikely. As you can see, V8ICUData.ResourceName is a string constant, so it should be valid unless its assembly couldn't be loaded, in which case a very different exception would have been thrown.

Also, forcing that argument to null yields a different error message on .NET Framework and .NET Core/5/6:

Unhandled Exception: System.ArgumentNullException: String reference not set to an instance of a String.
   at System.Reflection.RuntimeAssembly.GetResource(RuntimeAssembly assembly, String resourceName, UInt64& length, StackCrawlMarkHandle stackMark, Boolean skipSecurityCheck)
   at System.Reflection.RuntimeAssembly.GetManifestResourceStream(String name, StackCrawlMark& stackMark, Boolean skipSecurityCheck)
   at System.Reflection.RuntimeAssembly.GetManifestResourceStream(String name)
   at Microsoft.ClearScript.V8.V8Proxy.InitializeICU()
   at Microsoft.ClearScript.V8.V8Proxy.OnEntityHolderCreated()
   at Microsoft.ClearScript.V8.SplitProxy.V8EntityHolder..ctor(String name, Func`1 acquireHandle)
   at Microsoft.ClearScript.V8.SplitProxy.V8IsolateProxyImpl..ctor(String name, V8RuntimeConstraints constraints, V8RuntimeFlags flags, Int32 debugPort)
   at Microsoft.ClearScript.V8.V8Runtime..ctor(String name, V8RuntimeConstraints constraints, V8RuntimeFlags flags, Int32 debugPort)
   at Microsoft.ClearScript.V8.V8ScriptEngine..ctor(V8Runtime runtime, String name, V8RuntimeConstraints constraints, V8ScriptEngineFlags flags, Int32 debugPort)

Interestingly, the Mono runtime does produce the default "Value cannot be null" message. Do you know if your issue was reported by someone using Mono?

In any case, please let us know if you find a way to reproduce this issue.

Thanks!

ClearScriptLib avatar Jul 24 '22 04:07 ClearScriptLib

In any case, please let us know if you find a way to reproduce this issue.

Unfortunately, I have not yet received a detailed description of this error from @timheuer.

Taritsyn avatar Jul 24 '22 10:07 Taritsyn

Hi Andrey,

Please feel free to reopen this issue if you find a way to reproduce the problem.

Thanks!

ClearScriptLib avatar Aug 29 '22 15:08 ClearScriptLib

OK

Taritsyn avatar Aug 29 '22 15:08 Taritsyn