Calling FbServerProperties.GetDatabasesInfo() generates a NullReference 
exception
---------------------------------------------------------------------------------

                 Key: DNET-641
                 URL: http://tracker.firebirdsql.org/browse/DNET-641
             Project: .NET Data provider
          Issue Type: Bug
          Components: ADO.NET Provider
    Affects Versions: 4.8.1.0
         Environment: Windows 10 Professional 64-bit; .NET 4.6; VS 2015
            Reporter: Peter Taylor
            Assignee: Jiri Cincura
            Priority: Blocker


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);
                        }
                }
        }

    */


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to