Bug in ProgramEntry.cs
Posted: Sat Feb 13, 2021 4:16 pm
Our plugin has dependencies that will resolve with failures (not avoidable, blaming grpc due to its multi-platform features), the problem is that resolveArgs.Name will not always have commas so opendental will crash.
ProgramEntry.cs line 94 (at least in v19.4)
Below is code that would fix the issue, just checking to make sure that arrParts[] actually contains elements before continuing.
Could we please get this fixed and backport it? Thanks
ProgramEntry.cs line 94 (at least in v19.4)
Below is code that would fix the issue, just checking to make sure that arrParts[] actually contains elements before continuing.
Could we please get this fixed and backport it? Thanks
Code: Select all
private static Assembly AssemblyResolveFailures(object sender,ResolveEventArgs resolveArgs) {
string assemblyInfo=resolveArgs.Name;// e.g "Lib1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
string[] arrParts=assemblyInfo.Split(',');
if (arrParts.Length > 1) {
string name = arrParts[0];
Version version = Version.Parse(arrParts[1].Split('=')[1]);
string fullName;
if (name == "Newtonsoft.Json" && version.Major.In(7, 9)) {
//OpenDentalCloud.dll references Dropbox.Api.dll which references Newtonsoft.Json.dll version 7.0.0.0. Sometimes it also says it can't find
//9.0.0.0.
fullName = ODFileUtils.CombinePaths(AppDomain.CurrentDomain.BaseDirectory, "Newtonsoft.Json.dll");
}
else {
return null;
}
return Assembly.LoadFile(fullName);
}
else
return null;
}