Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DNX Core 5.0 error CS1061: 'SqlDataReader' does not contain a definition for 'Close'

Tags:

c#

sql

asp.net5

I managed to install System.Data.SqlClient from Nuget and I can use SqlConnection and SqlDataReader to read. But why error says Close() for SqlDataReader missing for DNX core 5?

DNX Core 5.0 error CS1061: 'SqlDataReader' does not contain a definition for 'Close' and no extension method 'Close' accepting a first argument of type 'SqlDataReader' could be found (are you missing a using directive or an assembly reference?)

like image 899
Bing Lan Avatar asked Oct 18 '22 10:10

Bing Lan


1 Answers

You should upgrade to RC2 now.

Such Close methods have been removed in many types, and you should call Dispose in most cases instead.

like image 199
Lex Li Avatar answered Oct 26 '22 23:10

Lex Li