Issues with JSON

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
cgorman
Posts: 1
Joined: Tue 11 Mar 2014 20:31

Issues with JSON

Post by cgorman » Wed 12 Mar 2014 21:03

Are there any known issues with dotConnect for Oracle and JSON web requests? I am trying to populate a few cascading drop-down lists via JSON web requests to some web services, but I keep getting sporadic errors. Here are the errors I get in no specific order:

1. Byte array for GUID must be exactly 16 bytes long.
2. Object reference not set to an instance of an object.
{"Cannot access a disposed object.\r\nObject name: 'DataContext accessed after Dispose.'."}
3. Error on opening DbConnection. ConnectionString property not initialized.
4. Cannot access a disposed object. Object name: 'ITable'.

The table I am pulling records from does have a GUID field, but all of the data is valid. I should also mention those same methods work perfectly when called within an AJAX panel and with AutoPostBack set to true. They just do not work consistently once the calls are turned into JSON web requests. Sometimes, there are no errors, but at some point an error will be thrown even if the same values worked just moments before ago.

If you need to see any code, just let me know which piece you need. I couldn't find anything in the forums about people using JSON.

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Issues with JSON

Post by MariiaI » Fri 14 Mar 2014 12:35

Regarding some of the errors you are getting:
> 1. Byte array for GUID must be exactly 16 bytes long.
Probably the data is stored in different formats in database and in your code. For example, we do not get an error in this case:
The table:

Code: Select all

CREATE TABLE MARIIAI.TABLE3 (
  ID   NUMBER(32, 0),
  GUID RAW(16),
  CONSTRAINT PK_TABLE3 PRIMARY KEY (ID)
)
The corresponding entity class

Code: Select all

public partial class TABLE3 : INotifyPropertyChanging, INotifyPropertyChanged
    {...
        private System.Nullable<System.Guid> _GUID;...}
The code

Code: Select all

SCOTTDataContext ctx = new SCOTTDataContext() { Log = Console.Out };
SCOTTContext.TABLE3 tt = new TABLE3() { ID = 1, GUID = Guid.NewGuid() };
ctx.TABLE3S.InsertOnSubmit(tt);
ctx.SubmitChanges();
> 2. Object reference not set to an instance of an object.
{"Cannot access a disposed object.\r\nObject name: 'DataContext accessed after Dispose.'."}
This means that you are trying to access DataContext object after it has been disposed. This error can occur when you are using one static DataContext object in different methods and using blocks, e.g.:

Code: Select all

static SCOTTDataContext ctx = new SCOTTDataContext();
...
using (ctx)
{
results = ctx.TABLE3S.ToList();
}
var items = ctx.TABLE3S.ToList();
> 3. Error on opening DbConnection. ConnectionString property not initialized.
Please make sure that you have specified a connection string before opening a connection. For example, make sure the connection string is specified in the *.config file of the application in case you are using the default DataContext constructor.
> 4. Cannot access a disposed object. Object name: 'ITable'.
This error means the same as in the 2) clause.

Please send us a test project with your LinqConnect model and corresponding DDL/DML scripts for reproducing these issues (if possible with the comments for the parts of code where each error occurs), so that we are able to find a solution for you.

Post Reply