You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The uninitialsied List<string> _databases member is used by FbDatabasesInfo.AddDatabase(string database) method [ _databases.Add(database)]
_databases IS initialised by a call to FbDatabasesInfo.Databases property - but that is too late.
Here is the offending code ( I can send a simple sample project demonstrating the issue, if required):
/\* This is the code where it goes wrong: NETProvider\\src\\FirebirdSql\.Data\.FirebirdClient\\Services\\FbDatabasesInfo\.cs
using System;
using System\.Collections\.Generic;
namespace FirebirdSql\.Data\.Services
\{
public class FbDatabasesInfo
\{
public int ConnectionCount \{ get; internal set; \}
// this member is used before being initialised
private List<string\> \_databases; // = new List<string\>\(\);
#⁠if \(NET\_40\)
public IList<string\> Databases
#⁠else
public IReadOnlyList<string\> Databases
#⁠endif
\{
get
\{
return \(\_databases ?? \(\_databases = new List<string\>\(\)\)\)\.AsReadOnly\(\);
\}
\}
internal FbDatabasesInfo\(\)
\{ \}
internal void AddDatabase\(string database\)
\{
// this is where the uninitialised member is used, when FbServerProperties\.GetDatabasesInfo\(\) is called
\_databases\.Add\(database\);
\}
\}
\}
\*/
I checked the ETW ModuleLoad Events in WPA.exe and see that FirebirdSql.Data.FirebirdClient.dll gets loaded from GAC: C:\Windows\http://Microsoft.Net\assembly\GAC_MSIL\FirebirdSql.Data.FirebirdClient\v4.0_4.9.0.0__3750abcc3150b00c\FirebirdSql.Data.FirebirdClient.dll
This FirebirdSql.Data.FirebirdClient.dll is .net 4.5, while the project uses .net 4.0. And because the 4.5 version is loaded the Method is missing and I get the crash.
So try to avoid such #if calls and use the types that are part of all versions.
Submitted by: Peter Taylor (petertaylor)
The uninitialsied List<string> _databases member is used by FbDatabasesInfo.AddDatabase(string database) method [ _databases.Add(database)]
_databases IS initialised by a call to FbDatabasesInfo.Databases property - but that is too late.
Here is the offending code ( I can send a simple sample project demonstrating the issue, if required):
Commits: e94a4dd
The text was updated successfully, but these errors were encountered: