This project has moved. For the latest updates, please go here.

Having Problems in the beggining

Apr 11, 2012 at 12:04 PM

Im am sorry if I'm not seeing something obvious, but my problem is :

When I create a console application , add the Catfood.Shapefile.dll and the reference and etc. Then I write the code in the documentation example.

using (Shapefile shapefile = new Shapefile(@"D:\Marti_ochertaniq\Maria_shapes\Export\20120326_160600_183247\BZS_1606.shp"))
{
foreach (Shape shape in shapefile)
{
Console.WriteLine("ShapeType: {0}", shapefile.Count);
 
}

I'm just trying to learn to work with shapefiles, as I need to implement an import a shapefile in database in a silverlight application. The current problem is that when i write this, Im trying to learn making tests, I get the following error in the shapefile.cs  "NullReferenceException was unhandled". 

The exception is on line: 444  -  if (!_dbReader.Read()) ...

I tried with 3 different shapefiles, hoping that there is something wrong in my .dbf file, yet none of them works. I get the same error over and over. 

I would appriciate if someone tells me how to solve or workarround this problem.

Thanks. 

Coordinator
Apr 12, 2012 at 3:42 PM

Catfood.Shapefile doesn't currently support Silverlight. It sounds like you're getting this crash in a regular console app though. Looks like _dbReader is null - which connection string are you using? Can you post the full stack, and if possible the shapefile that results in this error?