Skip to content
New issue

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

Buffer cannot be null. [DNET674] #628

Closed
firebird-automations opened this issue Mar 27, 2016 · 9 comments
Closed

Buffer cannot be null. [DNET674] #628

firebird-automations opened this issue Mar 27, 2016 · 9 comments

Comments

@firebird-automations
Copy link

Submitted by: fish (fishcodelib)

The JOB table in the employee.fdb database can not be queried when executing the statement:
SELECT "LANGUAGE_REQ" FROM "JOB" WHERE "MAX_SALARY"=46900
Got the exception: Buffer cannot be null.

You can get the example file from:
'Firebird-2.5.5.26952-0_x64\examples\empbuild\employee.fdb'

@firebird-automations
Copy link
Author

Commented by: @cincuranet

Provide a test case. Using straightforward code:
conn.Open();
using (var cmd = conn.CreateCommand())
{
cmd.CommandText = "SELECT \"LANGUAGE_REQ\" FROM \"JOB\" WHERE \"MAX_SALARY\"=46900";
using (var reader = cmd.ExecuteReader())
{
while (reader.Read())
{
}
}
}
does not result in any error.

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: Open [ 1 ] => In Progress [ 3 ]

@firebird-automations
Copy link
Author

Commented by: fish (fishcodelib)

while (reader.Read()) {
Debug.WriteLine(reader.Item(0)); // Here is the exception thrown
}

@firebird-automations
Copy link
Author

Commented by: @cincuranet

There's no `Item` method on `FbDataReader`. I suppose you meant first column from reader. But even the `reader[0]` does not fail. Even the first item from the array does not fail (`((string[])reader[0])[0]`).

@firebird-automations
Copy link
Author

Commented by: fish (fishcodelib)

while (reader.Read())
{
System.Diagnostics.Debug.WriteLine((string)reader[0]);// Here is the exception thrown
}
If you set the connection string that includes "Character Set=UTF8;"

@firebird-automations
Copy link
Author

Commented by: @cincuranet

OK, so the interesting part is the charset, not the code (which will in this case result in invalid casting). Why it was not included in first place? And stack trace?

@firebird-automations
Copy link
Author

Commented by: fish (fishcodelib)

at System.IO.MemoryStream..ctor(Byte[] buffer, Boolean writable)
at System.IO.MemoryStream..ctor(Byte[] buffer)
at FirebirdSql.Data.Client.Managed.XdrStream..ctor(Byte[] buffer, Charset charset)
at FirebirdSql.Data.Client.Managed.Version10.GdsArray.DecodeSlice(Byte[] slice)
at FirebirdSql.Data.Common.ArrayBase.Read()
at FirebirdSql.Data.Common.DbValue.GetArrayData(Int64 handle)
at FirebirdSql.Data.Common.DbValue.GetArray()
at FirebirdSql.Data.Common.DbValue.GetValue()
at FirebirdSql.Data.FirebirdClient.FbDataReader.<>c__DisplayClass43_0.<GetValue>b__0()
at FirebirdSql.Data.FirebirdClient.FbDataReader.CheckedGetValue[T](Func`1 f)
at FirebirdSql.Data.FirebirdClient.FbDataReader.GetValue(Int32 i)
at FirebirdSql.Data.FirebirdClient.FbDataReader.get_Item(Int32 i)

@firebird-automations
Copy link
Author

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: In Progress [ 3 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: vNext [ 10760 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants