Please be aware that the SAP SQL Anywhere Forum will be shut down on August 29th, 2024 when all it's content will be migrated to the SAP Community.

I'm building an application and I have an EF4 EDM. I have imported a number of stored procedures as function imports into the model. Most of these functions do not return any return value.

I'm getting the following null reference exception when I call one of these function import methods:

System.NullReferenceException: Object reference not set to an instance of an object.
   at System.Data.EntityClient.EntityDataReader.Close()
   at System.Data.EntityClient.EntityDataReader.Dispose(Boolean disposing)
   at System.Data.Common.DbDataReader.Dispose()
   at System.Data.EntityClient.EntityCommand.ExecuteScalar[T_Result](Func`2 resultSelector)
   at System.Data.EntityClient.EntityCommand.ExecuteNonQuery()
   at System.Data.Objects.ObjectContext.ExecuteFunction(String functionName, ObjectParameter[] parameters)
   at LPRCore.CarSystem.CarSystemEntities.UpsertList(Nullable`1 listId, String listName, Nullable`1 listTypeId, Nullable`1 domainId, String salt, Nullable`1 lastUpdated, Nullable`1 whiteListAlarmClassId, Nullable`1 subscriber, Nullable`1 instanceId) in D:\ElsagTFS\EOC4\Client\LPRCore Plugin CarSystem\CarSystemModel.Designer.cs:line 2050
   at LPRCore.CarSystem.HotListDataAccessor.SaveHotList(CarSystemEntities context, Nullable`1 subscriberId, Nullable`1 instanceId, HotList data) in D:\ElsagTFS\EOC4\Client\LPRCore Plugin CarSystem\HotListDataAccessor.cs:line 268

How do I correct this, or is it a problem in the provider?

Tony

asked 07 Sep '12, 14:07

TonyV's gravatar image

TonyV
1.2k333967
accept rate: 75%

edited 07 Sep '12, 16:10

Volker%20Barth's gravatar image

Volker Barth
40.5k365556827


I've found that the null reference exception does not occur if I modify the stored procedure so it returns a value by adding "SELECT 1;" to the end of the stored procedure. This is even though the Function Import's properties indicate that the return type is None.

We are actually in the process of evaluating SA and I have a contact inside Sybase. I've also reported this to him. He's been able to reproduce the issue and has sent it to the internal team responsible for this. So it is probably going to be fixed and released soon.

permanent link

answered 08 Sep '12, 11:10

TonyV's gravatar image

TonyV
1.2k333967
accept rate: 75%

This issue has been tracked and fixed under CR 718762.

This fix will be in 12.0.1.3790, 11.0.1.2871, and future EBFs.

permanent link

answered 14 Sep '12, 15:43

Tyson%20Lewis's gravatar image

Tyson Lewis
2.2k1641
accept rate: 22%

Tyson: Thanks! When will this EBF be released?

(17 Oct '12, 10:42) TonyV
1

If you're on MacOS, build 3798 should contain that fix. Otherwise wait and see ... ;-)

(17 Oct '12, 11:55) Reimer Pods
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×69

question asked: 07 Sep '12, 14:07

question was seen: 3,514 times

last updated: 17 Oct '12, 11:55