Intermittent error "Input string was not in a correct format."

Hi,

We've started getting strange errors from within a radwindow in our application that has been running fine for months.

The code has not changed recently.  The error seems to be produced very intermittently, but happens when a users clicks on a button within the radwindow - I've added logging and try catch blocks within every procedure/function in the page that is loaded in the radwindow. The code for the button click event is never fired when the error is prodced, instead the following error is thrown and logged by global.asax.  Do you have any idea what may be causing this?

Error Caught in Application_Error event
Error in: http://mywebsite.co.uk/filter.aspx?SiteID=325413&t=635530314166978027&altIconPath=&sliderSkin=Outlook&filterbg=&bookieList=&List=&List2=&List3=&rwndrnd=0.46842012647539377
Error Message:Input string was not in a correct format.
Stack Trace:   at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
   at System.ComponentModel.Int32Converter.FromString(String value, NumberFormatInfo formatInfo)
   at System.ComponentModel.BaseNumberConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
Target Site:Void StringToNumber(System.String, System.Globalization.NumberStyles, NumberBuffer ByRef, System.Globalization.NumberFormatInfo, Boolean)

This is extremely intermittent, I've never actually manged to reproduce it myself so I'm relying on user feedback and logs.  So, to recap, it seems that as soon as they click on the button (normal asp button) they see the error and I can see from the logs that the handler code for the button click did not seem to run as it should log an event as soon as they click.

The logs do seem to show that when it happens to one user they can retry several times and it keeps erroring for them, but they will be able to use without error, presumably when they refresh the whole page.

I've tried everything I can think of.  Adding logs everywhere, changing buttons from Telerik RadButtons to regular radbuttons, moving to another web server, upgrading from .net 3.5 to 4.5, still the errors come.

Let me know if you need any more information.

Many thanks in advance

cp
cp30Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

melmersSenior Software Deveolper/ArchitectCommented:
Hello,

such a error is very hard to track. At first you must identify when the error will be thrown.

Can an user reproduce the error for you? Can he create a video or with PSR a file to reproduce the
error correctly? Often error entries written by mail or transfered by phone will have not all details.

Do you have analyzed if the error will only throws by a specific version of browser? (only IE/Firefox/ etc..)

Does this error come if a user inputs the wrong number format like the dot from decimal numbers. In Germany the comma will be used as a decimal point.

Do you have the chance to use IntelliTrace on the server, this requires Visual Studio Ultimate Edition ?

Have you or your admins installed any updates ?

Do you use autmomatic binding of data to your controls ? can the controls update the datasource ?

Regards,

Mario
0
cp30Author Commented:
Hi,

No user can reproduce the error consistently.  I have tracked IPs that have received the error, most are Chrome 39.0 but I have seen one recently which was Opera also.  IPs also show from Uk and other countries.

The only input fields on the form are telerik numeric textboxes and it is impossible for me when testing to enter anything other than the accepted number format.  

We do not have Ultimate Edition of VS :(

No updates have been installed recently.  It is only myself that administers system.

There is automatic binding on some controls on that page, but they do not update the db.

Thanks

Cp
0
cp30Author Commented:
What I cannot understand is how the error can be thrown on the click of a button, yet the code behind that button is never fired (as I have a log event as the first line), but instead the error is thrown.  I've never come across anything like that before, always been able to debug or use logging to find the problem and then resolve.

So even if my textboxes on that page did have string instead of numeric values, surely I'd expect to see that cause an error when the actual code inside the button was run?

Really at a loss with this, never been so stumped and wasted so much time trying to get to the bottom of a .net issue before.
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

melmersSenior Software Deveolper/ArchitectCommented:
I assume that you use asp.net webforms. So there are many events before you button handler code will be fired. Have you any code in Page init or page load? There are other events which could run before your button code runs. I will post you tomorrow a link to a page where the rank of the events are shown
.
0
cp30Author Commented:
Hi,

Yes, it is asp.net web forms.  

I have wrapped every sub/function in try catch with logs so I can see when they are started and when they hit an exception.  Problem is, that no code in 'any' procedure of function seems to get fired before the error.

Thanks for posts.

Cp
0
Ashutosh VyasFounder, InitQubeCommented:
Can you put up the code for your page here. Esp if you have something on Page Init or Page Load.

Even it could be possible that the telerik controls that you are using internally would call some methods to restrict your entries to numeric or convert the entered text to numeric. Thereby raising the errors.

An exact idea of what the controls are and what the page code is would help
0
cp30Author Commented:
Hi,

We only have code in the page load, the other page events are empty (init, preinit etc).  I can copy the code in here if you think that will help but the first thing it does in the page load event is to write to the log and I can see from the logs that that first line never gets run.

I beginning to think it may be worth replacing the RadNumericTextBoxes and validating them as numbers server side or in basic javascript and running that for a while to see if it could be the Telerik RadNumericTextBoxes that are causing the error?
0
Ashutosh VyasFounder, InitQubeCommented:
This might be a problem with the underlying RadNumeric textboxes.

You could use HTML5 type=number also

<input type="number" min="5" max="18" step="0.5" value="9" >

Open in new window

0
melmersSenior Software Deveolper/ArchitectCommented:
Do you bind the property to the text or the value property of the control?
0
cp30Author Commented:
Hi,

I can now rule out the RadNumericTextboxes as I have replaced with standard textboxes and the error still gets logged.  I actually left the textboxes open to non-numeric characters being entered as the code seems to handle this just fine when I test and simply returns a nicely handled error in the grid that gets refreshed  in the underlying page, so I know that it can handle non-numeric values just fine.

Melmers: we were setting the dbValue property of the textbox that Telerik recommend as I believe it handles exceptions better.

We are running out of things to remove from the filter page - I have now removed the 3 Telerik RadListboxes that were also on the page and had to add a message to our users that only limited filtering will be available for a short maintenance period.  We now have only 5 regular textboxes, and a Telerik RadSlider,  I guess it's trial and error to see which controls we remove stops the errors cropping up in the log - as I can't seem to apply much other logic to it.

Many thanks for suggestions so far - any more gladly welcomed.
0
melmersSenior Software Deveolper/ArchitectCommented:
Do you use master pages as well? If yes do you have logging enabled on the master page?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
melmersSenior Software Deveolper/ArchitectCommented:
Another thing which you can prove, do you use an ORM framework like Entity Framework ?
If yes are the datatypes of your ORM model and the database tables in sync ?
0
cp30Author Commented:
No, sorry, we don't use an ORM framework
0
melmersSenior Software Deveolper/ArchitectCommented:
Can you post the code how you retrive the data for the control and the
binding code of the control?
0
cp30Author Commented:
yes, which control - all of them on the page?
0
melmersSenior Software Deveolper/ArchitectCommented:
Post the complete code of the page and the master page
0
cp30Author Commented:
Ok, I just need to get confirmation from the company owner to ensure that he's happy for me to share all the code from those pages without removing anything sensitive.

Thanks
0
cp30Author Commented:
"think" I may have just found the problem!

Found this post so suspecting that it could well be the listboxes that were causing the issue.  Will regress to previous full-featured page and then apply the fix and wait to see if the problem is resolved

http://www.telerik.com/forums/system-formatexception-78e82e51af27

Fingers crossed!

Thanks

Cp
0
cp30Author Commented:
The link in my last message was indeed my issue exactly and was fixed by the suggested code.

Many thanks for your efforts of assistance.

Cp
0
cp30Author Commented:
Discovered solution and fix from Telerik website.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.