Trouble with JSON parsing

Vote:
 

Hi,

We are in the process of upgrating a site from Episerver 6 R2 to EPiServer 7. The site uses 

ElencySolutions.MultipleProperty, when editing the properties in Episerver 7 we sometimes get the following error:

Value cannot be null.
Parameter name: s

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: s

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 

[ArgumentNullException: Value cannot be null.Parameter name: s] 
System.IO.StringReader..ctor(String s) +14418294
EPiServer.UI.Edit.EditProperty.ApplyPostedValue() +335
EPiServer.UI.Edit.EditProperty.Page_Init(Object sender, EventArgs e) +183
System.Web.UI.Page.OnInit(EventArgs e) +102
EPiServer.UI.ContentBaseWebForm.OnInit(EventArgs e) +16
System.Web.UI.Control.InitRecursive(Control namingContainer) +186
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2098

We have figured out that the error result from Json Deserialization. It looks like single quotes " ' " is not escaped so the post request done to the server are missing data.

A sample post failing request:

value:
[{"heading":"Nyheter Europa","description":"<p>Les mer om Norge
 
The expected request should look like:
value:
[{"heading":"Nyheter Europa","description":"<p>Les mer om Norge\'s arbeid i Europa.</p>","link":null,"linkName":""}]
 
If I change the single quote with a double quote the request succeedes:
value:
[{"heading":"Nyheter Europa","description":"<p>Les mer om Norge\"s arbeid i Europa.</p>","link":null,"linkName":""}]
 
As we see when I replace the single quote with a double it gets escaped and all works fine.
So the single quotes dont get escaped correctly.
 
Does anyone know how to fix this?
#65839
Feb 12, 2013 9:26
Vote:
 

I have reported a bug for this:

Bug #95698: Legacy editor dialog does not escape single quotes
 
We will see if there is a possible fix/workaround for this and post if here.
#65840
Feb 12, 2013 9:49
Vote:
 

Linus Ekström thanks for the quick response. Just to clearify this error happens when we edit properties in EPiServer 7 form editor modus. Is this the same as the Legacy editor dialog you refere to

#65845
Edited, Feb 12, 2013 10:43
Vote:
 

When you edit in the new editing UI we have a specific legacy editor that uses a pop up to load forms based editors. I'm guessing that this is where you are having problems.

#65850
Feb 12, 2013 11:46
Vote:
 

Linus do you have any update on the progres on the bug you reported?

#66252
Edited, Feb 25, 2013 17:42
Vote:
 

Unfortunately it's still active so noone has fixed it yet.

#66253
Feb 25, 2013 17:46
Vote:
 

Well, I don't see the necessity of escaping ' in this case. I tried LinkCollection property which worked fine. Could you please post the entire request body.

#66452
Feb 28, 2013 17:06
Vote:
 

Thanks for the response Duong Nguyen

I have a property defined like this 

[Display(
Name = "Venstremeny",
Description = "Liste med linker som blir menyen til venstre på siden",
Order = 10)]
[BackingType(typeof(PropertyLinkCollection))]
[CultureSpecific]
[Required]
public virtual LinkItemCollection LeftMenuLinks { get; set; }

 

When I add a new link the request look like:

ctl00$FullRegion$propertyValueField:

ctl00$FullRegion$LeftMenuLinks$ctl00$LinkValue: -1|http://vg.no|||les's mer

ctl00$FullRegion$SaveButton: Lagre

So everithing looks ok, and im able to save the linklist.

 

But when I try to open the list to edit it i get the exception detailed above. This error also happens if  I publish the page before editing the list  

the request done when i open the link list for edit is:

value:[{"attributes":{"href":"https://yyy.xxxxx.no/DesktopDefault.aspx"},"text":"yyy","langauge":"no","href":"https://yyy.xxxxx.no/DesktopDefault.aspx","target":null,"title":null},{"attributes":{"href":"https://www.nettavregning.no/Logginn.aspx?ReturnUrl=%2fDefault.aspx"},"text":"Nettweb","langauge":"no","href":"https://www.nettavregning.no/Logginn.aspx?ReturnUrl=%2fDefault.aspx","target":null,"title":null},{"attributes":{"href":"https://ffff.xxxxx.no/ffff/"},"text":"ffff","langauge":"no","href":"https://ffff.xxxxx.no/ffff/","target":null,"title":null},{"attributes":{"href":"http://home.xxxxx.no/fasitweb/WebLoginPage.aspx?ReturnUrl=%2ffasitweb%2fDefault.aspx"},"text":"Fasitregistrering","langauge":"no","href":"http://home.xxxxx.no/fasitweb/WebLoginPage.aspx?ReturnUrl=%2ffasitweb%2fDefault.aspx","target":null,"title":null},{"attributes":{"href":"https://rkom.xxxxx.no/zzzz/pages/LogIn.aspx"},"text":"RK-opsjonsbud","langauge":"no","href":"https://rkom.xxxxx.no/zzzz/pages/LogIn.aspx","target":null,"title":null},{"attributes":{"href":"http://home.xxxxx.no/webrev/WebLogin/WebLoginPage.aspx?ReturnUrl=%2fwebrev%2fpages%2fRevisionOverview.aspx%3fmode%3dopen&mode=open"},"text":"WebRev","langauge":"no","href":"http://home.xxxxx.no/webrev/WebLogin/WebLoginPage.aspx?ReturnUrl=%2fwebrev%2fpages%2fRevisionOverview.aspx%3fmode%3dopen&mode=open","target":null,"title":null},{"attributes":{"href":"http://driftsdata.xxxxx.no/ddd"},"text":"Anleggsdata","langauge":"no","href":"http://driftsdata.xxxxx.no/ddd","target":null,"title":null},{"attributes":{"href":"http://driftsdata.xxxxx.no/ddd"},"text":"ddd","langauge":"no","href":"http://driftsdata.xxxxx.no/ddd","target":null,"title":null},{"attributes":{"href":"http://necs.xxxxx.no/default.aspx"},"text":"NECS","langauge":"no","href":"http://necs.xxxxx.no/default.aspx","target":null,"title":null},{"attributes":{"href":"~/link/c84c3a76e5e0408d86c397febe035a6c.aspx"},"text":"Kontaktinformasjon ved feil","langauge":"no","href":"~/link/c84c3a76e5e0408d86c397febe035a6c.aspx","target":null,"title":null},{"attributes":{"href":"http://vg.no"},"text":"les

 

 

#66456
Feb 28, 2013 17:39
Vote:
 

Does the text property have a single quote right at the place where json string is terminated? My test with ' was ok, and my json looked like: 

[{"name":"linkCollection","value":[{"attributes":{"href":"http://google.se","target":null,"title":null},"text":"Test's \" sadasd","langauge":"en","href":"http://google.se","target":null,"title":null}]

However, I am on latest development codebase. I will try on EPiServer 7 release to see if I can catch it.

#66462
Feb 28, 2013 18:06
Vote:
 

Hi

Yes you are right the text property had a ' at the place where the string is terminated. 

#66463
Feb 28, 2013 18:10
Vote:
 

Really strange. It works well on my EPiServer 7 release installation. One more question: The request content, where did you take it from? .NET request object or some http sniffer like Firebug or Fiddler?

#66477
Mar 01, 2013 10:45
Vote:
 

Hi,

The request content was taken from the developertool from Chrome 

#66495
Mar 01, 2013 13:58
Vote:
 

Hi,

I have an AlloyTech demosite running locally. If I have a property of type LinkItemCollection and create a link with a name with a ' in it, then try to edit this property after it is saved, I get the error:" Newtonsoft.Json.JsonReaderException: Unterminated string. Expected delimiter: ". Path '[0].text', line 1, position 57."

I don't have the newest patch of Episerver installed, so I don't know if that will make a difference, but this will be an easy way to reproduce the error.

#66520
Mar 04, 2013 10:11
Vote:
 

Hi, I can now reproduce on a fresh installation. I guess it was fixed sometime between 7.0 and 7.1. By the way, I am investigating what is exactly the cause and finding a work around if it is possible.

#66521
Mar 04, 2013 10:25
Vote:
 

Hi,

Nice that you where able to reproduce the the problem. On our site we use the Episerver 7 Patch from Jan 28 2013. I have used the (http://<site>/<UiPath>/shell/debug/showfileversions functionality to confirm that the correct dll hav been loaded. But we still experience the problem. 

Is this patch what you refere to as version 7.1?

#66522
Mar 04, 2013 10:42
Vote:
 

I confirm that it is a bug on EPiServer 7 release. You can find on our public bug list (#91190). It is fixed and will be available on the coming release.

Unfortunately, I cannot provide any workaround since the main cause is quite in the core part of our scripts.

Thor: Sorry, the patch doesn't help this case. The fix was done on client side. I would recommend you to wait for the very soon coming Sparrowhawk 7.1 release.

#66546
Edited, Mar 04, 2013 17:03
Vote:
 

Hi Duong,

I see that the releas you were talking about came out yesterday. http://world.episerver.com/Articles/Items/EPiServer-7--Patch-2/, but I cant seem to find the issue muber (91190) in the list of fixed bugs.

When is this bugfix going to be released?

 

#68241
Mar 19, 2013 14:16
Vote:
 

Hi Thor,

I didn't mean the patch. There will be an update for EPiServer UI, which you can pull directly from EPiServer Add-on store. Not sure when it is out yet.

Regards.

#68242
Edited, Mar 19, 2013 14:26
Vote:
 

I am having the same issue we have currently upgrade to 7.13. is there a fix for this?

Thanks

#109715
Oct 13, 2014 15:36
Vote:
 

Hi Marie!

If you still have this issue I suggest that you open a support case and give a detailed explanation what's needed to reproduce the issue.

Regards
Linus

#111770
Oct 21, 2014 10:17
Vote:
 

Hello Linus / Duong / anyone, sorry for reviving such an old thread but i ran in to exactly this bug the other day and after some searching found this. Now as far as I can see neither of the bugs mentioned here (#95698, #91190) are listed on your bug page http://world.episerver.com/support/Bug-list/ . Is it possible that any fix done to this was reverted or was it never fixed? In any case, if it should be possible to fix this by upgrading some module, then what exactly and is there a guide on how to do it? For some reason when I try upgrading different modules on my site using the Add-on store it just works for a while and then nothing happends.

#175502
Edited, Feb 22, 2017 9:47
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.