Last Updated: 16 Nov 2016 16:41 by Will
FIX: radcaptcha throws unhandled NullReferenceException on server side when no default audio playback device exists.

Hello, currently running Telerik.Web.UI.dll v.2010.1.519.35.

A NullReferenceException is being thrown by w3wp.exe that eventually brings down the app pool (if it happens enough times in a short period):

Application: w3wp.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.NullReferenceException
   at System.Speech.Internal.ObjectTokens.RegistryDataKey..ctor(System.String, System.Speech.Internal.ObjectTokens.RegistryDataKey)
   at System.Speech.Internal.ObjectTokens.SAPICategories.DefaultDeviceOut()
   at System.Speech.Internal.Synthesis.VoiceSynthesis..ctor(System.WeakReference)
   at System.Speech.Synthesis.SpeechSynthesizer.get_VoiceSynthesizer()
   at System.Speech.Synthesis.SpeechSynthesizer.SetOutputStream(System.IO.Stream, System.Speech.AudioFormat.SpeechAudioFormatInfo, Boolean, Boolean)
   at System.Speech.Synthesis.SpeechSynthesizer.SetOutputToWaveStream(System.IO.Stream)
   at Telerik.Web.UI.CaptchaAudio.SpeakText()
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Threading.ThreadHelper.ThreadStart()

This error is found in the Application Windows Event log.

I can confirm that the server on which the website using the RadCaptcha control does *not* have a default Playback audio device (or any audio devices at all).

I am able to detect this particularly when trying to access/use a page that contains the audio-enabled RadCaptcha control.

If I change the ASP.NET code within the control definition from...
... to ...
... the error no longer occurs.

The audio files are in the default location within the directory structure of the web application (App_Data/RadCaptcha).

So, this leads me down two paths:
1) Is it a requirement for the web server to have an enabled default playback device in order for audio play to work on a RadCaptcha control?  If so, is this documented?
2) Can this NullReferenceException be handled more elegantly so that it does not crash the worker process altogether?

Given my current version (2010.1.519.35), the behavior might be different in a later version.  That would be of interest as well.

Thank you very much!
Last Updated: 24 May 2016 18:13 by Imported User
When the captcha image is stored in Cache and the page is viewed by multiple users, only the image that is generated for the last user will remain in the cache and its instance of the captcha will be the only one that will function correctly.
Last Updated: 29 Mar 2016 06:58 by Herbert
The RadCaptcha does not play audio when opened in Internet Explorer 11.
Last Updated: 10 Jun 2015 08:15 by ADMIN
Created by: Slav
Comments: 1
Category: Captcha
Type: Bug Report
An audio tag is created by the captcha control under IE10, event if the audio tag with WAVE files is not supported on this version of the browser.
Last Updated: 16 Feb 2015 14:57 by ADMIN
When the function Page.Validate() is called on first page load and there is a RadCaptcha on the page, an exception will be thrown because the validation code of the captcha is not yet generated.
Last Updated: 05 Nov 2013 15:51 by ADMIN
See the end of this supposed completed item which it is not.

Last Updated: 01 Nov 2013 09:27 by ADMIN
When the RadCaptcha is placed in UpdatePanel and several identical validation request are sent to the server, the captcha will pass validation for more than one request.