This is a migrated thread and some comments may be shown as answers.

Is this a bug in FindParamCollection serialization or regex attribute matching ?

8 Answers 75 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Alexey Shcherbak
Top achievements
Rank 1
Alexey Shcherbak asked on 20 Jul 2010, 01:00 PM
I prefer to study WebAii with snippets and examples ( documentation is really far from comprehensive, but framework is great btw)
Today I found some strange behaviour - I serialized FindParam to file, cause i cant figure what exactly i should write in my Find filters in one special case. I used this code to do serialization
private void filtersSerialization()
{
    var param = new FindParam(FindType.Content, "p:My Solutions Ltd",
    new[] { "onclick=~document.getElementById('cancel_return').value = '1';"});
 
    var paramCol = new FindParamCollection
    {
    { "Sample", param }
    };
 
    paramCol.Save(@"d:\AppParams.xml");
}

And this code created following text
<FindParamItem key="Sample" >
<FindParam TagName="a" XPath="" NodeIndexPath="" Type="Content" ContentType="TextContent"
ContentValue="p:My Solutions Ltd" TagOccurrenceIndex="-1" >
<Attributes />
<PartialAttributes>
<iAttribute Name="onclick" Value="document.getElementById('cancel_return').value = '1';" />
</PartialAttributes>
</FindParam>
</FindParamItem>

But this isnt exactly correct 
onclick should be with screened \'
<iAttribute Name="onclick" Value="document.getElementById(\'cancel_return\').value = \'1\';" />

Otherwise Find.ByParam wont find any element with this filter loaded from file.

I dont sure where exactly this bug belongs to - serialization or regex attribute matching, but this is a wrong behaviour. Save and Load should behave consistently.

UPDATE:
I found exact difference between in-memory creation of FindParam and deserialized from file:

In-memory FindParam have type of partial iAttribute.AttributeType = Event,
and deserialized one have iAttribute.AttributeType = Other.

And BeginQuote\EndQuote different either (None and DoubleQuote).


Any tips how to deserialize param with AttributeType = Event, and quotes set to None?
Direct xml didn't work =(


8 Answers, 1 is accepted

Sort by
0
Alexey Shcherbak
Top achievements
Rank 1
answered on 21 Jul 2010, 09:37 PM
bump. Could anyone check described above ? Does this serialization problem exists or this is only on my dev machine ?
0
Missing User
answered on 22 Jul 2010, 09:52 PM
Hello Alexey,

Thanks for the post. I was able to reproduce this locally, and it maybe the case that the deserialized FindParam is failing due to the AttributeType (as you mentioned in your post) or the RawValue not being set correctly.

I'll log a bug for this, and unfortunately, I could not find a work around. I understand that this could cause problems in reuse of find params, so you may need to find another way to access them for your tests.

Regards,
Nelson Sin
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Alexey Shcherbak
Top achievements
Rank 1
answered on 26 Jul 2010, 08:12 AM
I faced this only with single parameter so I just hardcoded it and going to wait for fix. Have no time to battle this bug myself, sorry.

Is there any way to get notified about bugfixes or changelogs automatically ?
0
Missing User
answered on 26 Jul 2010, 09:18 PM
Hi again Alexey,

There are the version notes in the 'What's new in this version?' link when you go to download the framework. But unfortunately, I don't think there is automatic updates for the framework like there are for WebUI Test Studio in the newsletter.

I was not able  come up with a workaround to get this working, but please let us know if you are able to find something for this.

Sincerely,
Nelson Sin
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Alexey Shcherbak
Top achievements
Rank 1
answered on 27 Jul 2010, 05:18 AM
Hi Nelson.
I think the origin of this bug lying somewhere in the way Find Param detect attribute type. Probably you do it in constructor, and there is well known that constructor won't be called on deserialization. So in that case it would be good if you incapsulate that routine from constructor to method, which should be called explicitly during deserialization event. 
I cant be more specific without source code and details how exactly you implement deserialization of FindParam xml. I could peek into your code with Reflector, but that could be license violation - i dont sure - i didnt read license agreement, as usually =). 
0
Missing User
answered on 27 Jul 2010, 06:03 PM
Hi again Alexey,

Thanks for the post and suggestion, I'll add this to the bug report.

Sincerely,
Nelson
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Alexey Shcherbak
Top achievements
Rank 1
answered on 27 Jul 2010, 09:13 PM
Telerik points stealing detected =). just kidding.

Thank for your support and involvement =)
0
Missing User
answered on 29 Jul 2010, 11:07 PM
Hi again Alexey,

Sorry about that, I always forget about Telerik points. I gave 500 points to your accont, thanks again for the report.

Regards,
Nelson Sin
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
Alexey Shcherbak
Top achievements
Rank 1
Answers by
Alexey Shcherbak
Top achievements
Rank 1
Missing User
Share this question
or