losing data from table

This forum is meant for questions and discussions about the X# language and tools
Post Reply
Jan@share.be
Posts: 89
Joined: Mon Nov 02, 2015 8:51 pm

losing data from table

Post by Jan@share.be »

Hi all

I have a (for me) mistery:

I define some classes with all export variables.
Some are of type 'another class', some are arrays of 'other classes' (or strings)
I declare a variable of the top class and

I use Jsonconvert.Deserialize to fill the variable with data that comes from internet in Json format.

So far, everything works, I get my data in the structured way as I designed it.

But

If I pass that variable to a method to process it, some of the data disappeares.
For some of the arrays, I get (in the debugger) the message that the item is "not available"
It stil knows how many items are in the array, but there is no data available.

I suppose it has to do with protected memory or so, but I have no clue how to tackle this.

so, all help is welcome.

thanks
User avatar
Chris
Posts: 5536
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: losing data from table

Post by Chris »

Hi Jan,

We'd really need to see some code to make a suggestion about this.

Can you create a shorter sample that reproduces the problem?
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Jan@share.be
Posts: 89
Joined: Mon Nov 02, 2015 8:51 pm

Re: losing data from table

Post by Jan@share.be »

Chris

Thanks for the response.

The code is a bit complex, so making a small test is not easy.
I have implemented a work-around that works fine.

But iIwould like to discuss this with you in Potsdam in Februari, if that is OK with you.

greetings (and best wishes for 2026)

Jan
User avatar
Chris
Posts: 5536
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Re: losing data from table

Post by Chris »

HI Jan,

Yes of course, we can run the actual code through the debugger in your machine and maybe we can find the problem.

Happy 2026 and see you next month!
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
mindfulvector
Posts: 26
Joined: Tue Jun 24, 2025 1:57 pm
Location: United States

Re: losing data from table

Post by mindfulvector »

I've noticed that some container objects such as Dictionaries do not actually have their keys or values visible in the debugger at runtime. I wonder if this is related to the issue you're running into?
Jan@share.be
Posts: 89
Joined: Mon Nov 02, 2015 8:51 pm

Re: losing data from table

Post by Jan@share.be »

Best Wishes for all, have a nice 2026!!

I don't think the issue has to do with the debugger, I can see the full structure, but after passing it as a param to another method, part of the structure is gone.

I suppose it has to do with how the params are passed.

I'll check with Chris on the conference.
User avatar
ArneOrtlinghaus
Posts: 490
Joined: Tue Nov 10, 2015 7:48 am
Location: Italy

Re: losing data from table

Post by ArneOrtlinghaus »

Some years ago I had also a problem where the garbage collector sometimes deleted data of a complex structure hold in a local variable and then passed to another procecure by reference.

It can help if you define a global variable or a protect/export class variable of an object clearly in use and store a copy of the reference to the data in that variable as long as you need it.

The difference in .net in comparison to the old VO garbage collector is that the .net garbage collector is very quick and is running in another thread. This the way it is easier for the garbage collector to understand that the data is still used.

Arne
Post Reply