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

Error registering the viewer with the service string was not recognized as a valid DateTime.

8 Answers 901 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Stuart
Top achievements
Rank 1
Stuart asked on 07 Aug 2017, 10:01 AM

Using Telerik ReportViewer Q3 2015 SP2 v9.2.15.1126 in a MVC HTML5 website application.  I am experiencing an intermittent error with the reportviewer.

"Error registering the viewer with the service.  An error has occurred.  String was not recognised as a valid DateTime."

This occurs when instantiating a report for the first time (starting the website up and running a report).  However, rerunning the report immediately again I then get the expected result and it works fine without error, but the error is guaranteed to occur on every first time use.... 

Fiddler returns the following information:

{"message":"An error has occurred.","exceptionMessage":"String was not recognized as a valid DateTime.","exceptionType":"System.FormatException","stackTrace":"   at System.DateTimeParse.ParseExact(String s, String format, DateTimeFormatInfo dtfi, DateTimeStyles style)\r\n   at System.DateTime.ParseExact(String s, String format, IFormatProvider provider)\r\n   at Telerik.Reporting.Services.Engine.PersistableObject.GetDateTime(String key)\r\n   at Telerik.Reporting.Services.Engine.Client.get_ExpiresOn()\r\n   at Telerik.Reporting.Services.Engine.ReportEngine.<>c__DisplayClass16.<CollectExpiredData>b__10(Client c)\r\n   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()\r\n   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)\r\n   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)\r\n   at Telerik.Reporting.Services.Engine.ReportEngine.CollectExpiredData()\r\n   at Telerik.Reporting.Services.Engine.ReportEngine.RegisterClient()\r\n   at Telerik.Reporting.Services.WebApi.ReportsControllerBase.RegisterClient()\r\n   at lambda_method(Closure , Object , Object[] )\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at
System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()"}

 

Anyone experienced this before?  Any advice how to stop this from happening?  We have tried the obvious things like clearing browser history etc...

 

8 Answers, 1 is accepted

Sort by
0
Katia
Telerik team
answered on 10 Aug 2017, 07:26 AM
Hi Stuart,

We had one report about a similar issue, however, we never managed to reproduce it on our side and the cause of the issue was not discovered.
The client then reported that he managed to fix the issue by changing the HostAppId in ReportsController. It is not clear to us how this issue can be connected to the HostAppId setting.

In general, the error points that somewhere happens a conversion from string value into a DateTime value. If machines have different culture settings, the string may not be parse on one of them.

The things you can check:
  1. an expression used by the report e.g. TextBox.Value with formatting or a rule comparing values
  2. a mapping of field to a report parameter in a data-retrieval method, both field and parameter must be of DateTime type to avoid the automatic conversion
  3. a value passed to the report via report parameter

We can provide more accurate suggestions after testing a sample project that reproduces the issue.


Regards,
Katia
Progress Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Kiran
Top achievements
Rank 1
answered on 04 Jun 2018, 02:20 PM
Hi There.

I am facing the same issue "Error registering the viewer with the service string was not recognized as a valid DateTime". for testing purpose I am running the blank report. no data. no date. and still having the same message. please help on this

0
Kiran
Top achievements
Rank 1
answered on 04 Jun 2018, 02:22 PM
Fyi: I have started receiving this issue suddenly. nothing new has been installed on system
0
Silviya
Telerik team
answered on 07 Jun 2018, 10:28 AM
Hello Kiran,

Unfortunately, we are still not able to reproduce the error on our side. 

Please open new support ticket with a sample project that reproduces the problem in order to investigate it further and provide more accurate suggestions.
Additionally, please elaborate more on the following: 
- do you change the HostAppId string in ReportsController?
- what is your current culture set?
- which is the current used version of Telerik Reporting?

Regards,
Silviya
Progress Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Tim
Top achievements
Rank 1
answered on 13 Aug 2018, 07:02 PM

We encountered the same error. We build our product one time and deploy it to multiple clients. Only 1 client exhibited this behavior which rules out any application-specific issue. We also monitored for any data-related issue and found the request was failing on the request to api/reports/clients which caused every report to fail prior to any data-related processing. The notes about changing the HostAppId lead me to the consideration that something may be invalid in the Telerik Cache. I stopped the application pool and renamed the cache file as follows:

C:\Users\__serviceAccountName__\AppData\Local\Temp\__HostAppId__ 

Renamed to:

C:\Users\__serviceAccountName__\AppData\Local\Temp\__HostAppId-bk__ 

Where __serviceAccountName__ is the name of the application pool service account and __HostAppId__ is the value the ReportServiceConfiguration.HostAppId is set to.

When the application restarted I saw a new folder was created in place of the -bk folder and all reports run without any further issue.

I retained the backup files if they will help you further diagnose the issue and resolve the bug in your product.

 

 

 

0
Silviya
Telerik team
answered on 16 Aug 2018, 12:27 PM
Hi Tim,

Please check the support ticket with ID 1338344 that I opened on the same topic.

Regards,
Silviya
Progress Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Robert
Top achievements
Rank 2
answered on 17 Apr 2020, 05:00 PM
We are having the same issue.  It worked fine for months and then started getting this error one day.  Related in a Windows Update possibly?  I do not have access to the source code, so I cannot change the HostAppId.
0
Todor
Telerik team
answered on 22 Apr 2020, 11:41 AM

Hi Robert,

The error points to the Cache of the REST Service, so if you use FileStorage for the REST Service, I suggest to try to delete it. It will be recreated and the new requests will use the new storage.

Can you specify the Telerik Reporting version that you use?

Regards,
Todor
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
General Discussions
Asked by
Stuart
Top achievements
Rank 1
Answers by
Katia
Telerik team
Kiran
Top achievements
Rank 1
Silviya
Telerik team
Tim
Top achievements
Rank 1
Robert
Top achievements
Rank 2
Todor
Telerik team
Share this question
or