Click here to Skip to main content
15,892,005 members
Home / Discussions / C#
   

C#

 
AnswerRe: How internet Download manager Works? Pin
Afzaal Ahmad Zeeshan27-Sep-15 0:54
professionalAfzaal Ahmad Zeeshan27-Sep-15 0:54 
QuestionCopare two different dataGridView Pin
Member 1121917124-Sep-15 23:04
Member 1121917124-Sep-15 23:04 
AnswerRe: Copare two different dataGridView Pin
OriginalGriff24-Sep-15 23:25
mveOriginalGriff24-Sep-15 23:25 
AnswerRe: Copare two different dataGridView Pin
J. Calhoun25-Sep-15 3:11
J. Calhoun25-Sep-15 3:11 
AnswerRe: Copare two different dataGridView Pin
Gerry Schmitz25-Sep-15 8:20
mveGerry Schmitz25-Sep-15 8:20 
QuestionHow to implement Apriori using C# am new to C# Pin
Member 1199820924-Sep-15 21:13
Member 1199820924-Sep-15 21:13 
AnswerRe: How to implement Apriori using C# am new to C# Pin
Garth J Lancaster24-Sep-15 21:35
professionalGarth J Lancaster24-Sep-15 21:35 
Questiondebugging strategy ? Linq query mis-match using de-serialized complex class Pin
BillWoodruff24-Sep-15 12:53
professionalBillWoodruff24-Sep-15 12:53 
For me, debugging challenges are both the best and the worst experiences in programming; this one is a challenge I can "relish," since there's no deadline, no paycheck-on-the-line Smile | :)

I have a complex class that I serialize and de-serialize using WCF [DataContract] and [DataMember] Attributes without errors, or warning. In the test I've constructed to validate de-serialization are some Linq queries that when run against the de-serialized class instance come up with unexpected null results.

It appears I have Linq queries which give different results given identical inputs from which I assume, of course, that the problem is something subtle.

Here's an example of a query where the unexpected behavior (null result) is observed:
C#
public IEnumerable<Relationship> GetRelationships(string n1, string n2)
{
    Node fromNode = NameToNode[n1];
    Node toNode = NameToNode[n2];

    return
        Relationships.Where(r => r.EndNode == fromNode && r.StartNode == toNode)
        .Concat
        (
           Relationships.Where(r => r.StartNode == fromNode && r.EndNode == toNode)
        );
}

// test: 
// finds two matches with graph before serialization
// Empty Result using de-serialized graph
var rels = testGraph.GetRelationships("gina", "harry");
What is puzzling is that some Linq queries work fine, like this one:
C#
var wholikesjim = testGraph.Relationships.Where
     (rel => rel.Name == "Likes").Where(rel => rel.EndNode.Name == "jim"
     );
So far, I've done this:

0. (the obvious) inspected the serialized xml for "weirdness."

1. created a method to write all the various objects and their values to a TextBox, then compared the run-time report of the "native" version of the class instance to the de-serialized instance. The outputs are identical.

2. drilled down at run-time into the class instance using the debugger at the places where unexpected behavior occurs and noted the existing values/state of the various sub-objects when Linq queries are performed, then compared those before and after serialization/de-serialization.

The other queries which are not performing all use 'Join.

I'm stumped; I'll appreciate your ideas.
«I want to stay as close to the edge as I can without going over. Out on the edge you see all kinds of things you can't see from the center» Kurt Vonnegut.

AnswerRe: debugging strategy ? Linq query mis-match using de-serialized complex class Pin
Gerry Schmitz24-Sep-15 18:30
mveGerry Schmitz24-Sep-15 18:30 
GeneralRe: debugging strategy ? Linq query mis-match using de-serialized complex class Pin
BillWoodruff24-Sep-15 22:20
professionalBillWoodruff24-Sep-15 22:20 
GeneralRe: debugging strategy ? Linq query mis-match using de-serialized complex class Pin
Gerry Schmitz25-Sep-15 8:28
mveGerry Schmitz25-Sep-15 8:28 
GeneralRe: debugging strategy ? Linq query mis-match using de-serialized complex class Pin
Kenneth Haugland25-Sep-15 19:36
mvaKenneth Haugland25-Sep-15 19:36 
GeneralRe: debugging strategy ? Linq query mis-match using de-serialized complex class Pin
BillWoodruff26-Sep-15 1:11
professionalBillWoodruff26-Sep-15 1:11 
GeneralRe: debugging strategy ? Linq query mis-match using de-serialized complex class Pin
Gerry Schmitz28-Sep-15 6:15
mveGerry Schmitz28-Sep-15 6:15 
GeneralRe: debugging strategy ? Linq query mis-match using de-serialized complex class Pin
Kenneth Haugland28-Sep-15 9:18
mvaKenneth Haugland28-Sep-15 9:18 
Questionrun time validation for text box Pin
Member 1198293424-Sep-15 4:38
Member 1198293424-Sep-15 4:38 
AnswerRe: run time validation for text box Pin
Ravi Bhavnani24-Sep-15 4:45
professionalRavi Bhavnani24-Sep-15 4:45 
GeneralRe: run time validation for text box Pin
Member 1198293424-Sep-15 7:04
Member 1198293424-Sep-15 7:04 
AnswerRe: run time validation for text box Pin
OriginalGriff24-Sep-15 5:30
mveOriginalGriff24-Sep-15 5:30 
AnswerRe: run time validation for text box Pin
Gerry Schmitz24-Sep-15 9:01
mveGerry Schmitz24-Sep-15 9:01 
QuestionC# UserControl Inheritance Pin
didydj24-Sep-15 1:40
didydj24-Sep-15 1:40 
AnswerRe: C# UserControl Inheritance Pin
OriginalGriff24-Sep-15 2:19
mveOriginalGriff24-Sep-15 2:19 
AnswerRe: C# UserControl Inheritance Pin
BillWoodruff24-Sep-15 7:13
professionalBillWoodruff24-Sep-15 7:13 
AnswerRe: C# UserControl Inheritance Pin
Gerry Schmitz24-Sep-15 8:56
mveGerry Schmitz24-Sep-15 8:56 
GeneralRe: C# UserControl Inheritance Pin
BillWoodruff24-Sep-15 12:18
professionalBillWoodruff24-Sep-15 12:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.