Bug #75301 SqlNullValueException thrown when calling MySqlConnection::GetSchema
Submitted: 24 Dec 2014 0:11 Modified: 24 Mar 2015 0:08
Reporter: Colin Paterson Email Updates:
Status: In review Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:6.9.5.0 OS:Microsoft Windows
Assigned to: Gabriela Martinez Sanchez CPU Architecture:Any
Tags: GetSchema Index Columns

[24 Dec 2014 0:11] Colin Paterson
Description:
When you call MySqlConnection::GetSchema("IndexColumns") on a database that has a full text index defined a SqlNullValueException is thrown. This works as expected when there are no full text indexes but the exception is thrown when a full text search index is defined.

Exception is

System.Data.SqlTypes.SqlNullValueException was caught
  HResult=-2146232015
  Message=Data is Null. This method or property cannot be called on Null values.
  Source=MySql.Data
  StackTrace:
       at MySql.Data.MySqlClient.MySqlDataReader.GetFieldValue(Int32 index, Boolean checkNull)
       at MySql.Data.MySqlClient.MySqlDataReader.GetString(Int32 i)
       at MySql.Data.MySqlClient.MySqlDataReader.GetString(String column)
       at MySql.Data.MySqlClient.SchemaProvider.GetIndexColumns(String[] restrictions)
       at MySql.Data.MySqlClient.SchemaProvider.GetSchemaInternal(String collection, String[] restrictions)
       at MySql.Data.MySqlClient.ISSchemaProvider.GetSchemaInternal(String collection, String[] restrictions)
       at MySql.Data.MySqlClient.SchemaProvider.GetSchema(String collection, String[] restrictions)
       at MySql.Data.MySqlClient.MySqlConnection.GetSchema(String collectionName, String[] restrictionValues)
       

How to repeat:
Define a full text search index on any table and then run the following code

_connection.GetSchema("IndexColumns");

Suggested fix:
It shouldn't crash.
[24 Dec 2014 6:50] Chiranjeevi Battula
Hello Colin Paterson,

Thank you for the bug report.
Verified this behavior on Visual Studio 2013 (C#.Net) with  MySQL Connector/Net 6.9.5.

Thanks,
Chiranjeevi.