We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When the library is embedded as a resource, the EnumerateSatelliteLibrarySearchPaths method throws an exception.
This is because in the code
var runtimeAssembly = Assembly.GetExecutingAssembly(); string managedLocation = Path.GetDirectoryName(runtimeAssembly.Location) ?? AppDomain.CurrentDomain.BaseDirectory;
runtimeAssembly.Location is empty ("" => not null), and then Path.GetDirectoryName throw this excepcion:
"InnerException": { "$type": "System.TypeInitializationException, mscorlib", "TypeName": "ScintillaNET.Scintilla", "Message": "The type initializer for 'ScintillaNET.Scintilla' threw an exception.", "Data": { "$type": "System.Collections.ListDictionaryInternal, mscorlib" }, "InnerException": { "$id": "2", "$type": "System.ArgumentException, mscorlib", "Message": "The path is not of a legal form.", "ParamName": null, "Data": { "$type": "System.Collections.ListDictionaryInternal, mscorlib" }, "InnerException": null, "StackTrace": " at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths) at System.IO.Path.InternalGetDirectoryName(String path) at ScintillaNET.Scintilla.d__2.MoveNext() at ScintillaNET.Scintilla..cctor()", "HelpLink": null, "Source": "mscorlib", "HResult": -2147024809 }, "StackTrace": " at ScintillaNET.Scintilla..ctor() at ScintillaNET.WPF.ScintillaWPF..ctor()", "HelpLink": null, "Source": "Scintilla.NET", "HResult": -2146233036 }
I'm sorry I can't give an example because it's quite complex.
A possible solution is to change the code to the following:
var runtimeAssembly = Assembly.GetExecutingAssembly(); string managedLocation = string.IsNullOrWhiteSpace(entryPointAssembly.Location) ? AppDomain.CurrentDomain.BaseDirectory : Path.GetDirectoryName(runtimeAssembly.Location);
OR
var runtimeAssembly = Assembly.GetEntryAssembly(); string managedLocation = string.IsNullOrWhiteSpace(runtimeAssembly.Location) ? AppContext.BaseDirectory : (Path.GetDirectoryName(runtimeAssembly.Location) ?? AppDomain.CurrentDomain.BaseDirectory);
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered:
9e778c8
Merge pull request #149 from ahmetsait/master
c0daa4e
Fix #148: Exception when `Scintilla.NET.dll` is loaded from memory
desjarlais
No branches or pull requests
When the library is embedded as a resource, the EnumerateSatelliteLibrarySearchPaths method throws an exception.
This is because in the code
var runtimeAssembly = Assembly.GetExecutingAssembly();
string managedLocation = Path.GetDirectoryName(runtimeAssembly.Location) ?? AppDomain.CurrentDomain.BaseDirectory;
runtimeAssembly.Location is empty ("" => not null), and then Path.GetDirectoryName throw this excepcion:
"InnerException": {
"$type": "System.TypeInitializationException, mscorlib",
"TypeName": "ScintillaNET.Scintilla",
"Message": "The type initializer for 'ScintillaNET.Scintilla' threw an exception.",
"Data": {
"$type": "System.Collections.ListDictionaryInternal, mscorlib"
},
"InnerException": {
"$id": "2",
"$type": "System.ArgumentException, mscorlib",
"Message": "The path is not of a legal form.",
"ParamName": null,
"Data": {
"$type": "System.Collections.ListDictionaryInternal, mscorlib"
},
"InnerException": null,
"StackTrace": " at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
at System.IO.Path.InternalGetDirectoryName(String path)
at ScintillaNET.Scintilla.d__2.MoveNext()
at ScintillaNET.Scintilla..cctor()",
"HelpLink": null,
"Source": "mscorlib",
"HResult": -2147024809
},
"StackTrace": " at ScintillaNET.Scintilla..ctor()
at ScintillaNET.WPF.ScintillaWPF..ctor()",
"HelpLink": null,
"Source": "Scintilla.NET",
"HResult": -2146233036
}
I'm sorry I can't give an example because it's quite complex.
A possible solution is to change the code to the following:
var runtimeAssembly = Assembly.GetExecutingAssembly();
string managedLocation = string.IsNullOrWhiteSpace(entryPointAssembly.Location) ? AppDomain.CurrentDomain.BaseDirectory : Path.GetDirectoryName(runtimeAssembly.Location);
OR
var runtimeAssembly = Assembly.GetEntryAssembly();
string managedLocation = string.IsNullOrWhiteSpace(runtimeAssembly.Location) ? AppContext.BaseDirectory : (Path.GetDirectoryName(runtimeAssembly.Location) ?? AppDomain.CurrentDomain.BaseDirectory);
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: