Search Issue Tracker

By Design

Votes

0

Found in

5.5.1p4

Issue ID

914047

Regression

No

FileNotFoundException exception when there are special characters in the assembly path when calling Activator.CreateInstance

Mono

-

How to reproduce:
1. Open attached project
2. Attempt to enter play mode
3. Notice error in the console

Reproduced on: 5.5.0f1, 5.5.3p4, 5.6.1f1, 2017.1.0b6, 2017.2.0a1

Some Lithuanian characters that reproduce the issue: ą č ę ė į š ų ū
Other non-standard characters work too

Workaround:
Activator.CreateInstanceFrom(this.appDomain, proxyType.Assembly.CodeBase, proxyType.FullName); ->
Activator.CreateInstanceFrom(this.appDomain, proxyType.Assembly.Location, proxyType.FullName);

Activator.CreateInstanceFrom is passed a file name from proxyType.Assembly.CodeBase. This string is a URI, which is the local file name, prefixed with "file:///". This prefix indicates that Mono should treat the file name as a URI. It needs to escape any characters that in the string then. The result of this process leaves the 'é' in the path incorrectly modified. Then the assembly won't load, and the reported error occurs.

Instead of proxyType.Assembly.CodeBase, if proxyType.Assembly.Location is used, the script works as expected. The assembly is properly loaded. The Location property of assembly does not prefix the path with "file:///", so Mono does not attempt to escape characters in the URI. It treats the path as a local file path, which is properly found then.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.