I believe I've found an issue with the managed speech recognition libraries. The short problem description is that I am unable to use SRGS/.grxml files that contain "ruleref" elements pointing to other files with System.Speech.Recognition.SpeechRecognitionEngine (InProc). They load fine when using SpeechRecognizer.
After debugging (and finally making a custom build of System.Speech.dll), I've narrowed down on the issue. When you use an InProc recognizer, RecognizerBase.cs sets a custom grammar loader (ISpGrammarResourceLoader). Unfortunately, the RecognizerBase.LoadResource method that is used will receive a null value for the last argument ("pbstrRedirectUrl"), and cause a null exception when it tries to do a split on the null string. This also explains why SpeechRecognizer does not have any issues with the same files.
The same issue happens with both 3.5 and 4.0 versions of the Framework.
Problem
I can’t get a speech recognition project I started in 2008 to correctly load the grammar definition files (.grxml / SRGS) in my current environment (Windows 7 64-bit) with SpeechRecognitionEngine.
STATUS
Well, turns out that the shared SpeechRecognizer will correctly load the exact same GRXML files with external ruleref definitions. After hunting through the .NET source code, the culprit might be in the RecognizerBase.cs method named LoadSapiGrammarFromCfg(). It sets a custom grammar loader for SAPI only when using an InProc recognizer (which SpeechRecognitionEngine is). The comments even state “The rulerefs will be resolved locally.”
So, I have the following options:
- Continue debugging .NET to see if the behavior has changed, and I’m simply missing some element in the XML file. This doesn’t seem likely, as ProcMonitor clearly states that only the first file even gets a open/read attempt. I’ve tried setting the base URI, used absolute paths, did a quick attempt at loading from a URL. The problem is made worse by the fact that I can’t step through the .NET code in either Visual Studio 2008 or 2010. Fixing that will take its own time… I could try using the .NET Framework code (fingers crossed all the required files are available) directly.
- Switch to using SpeechRecognizer. I don’t want this, because I’d end up with a broader dictionary which will reduce accuracy.
- Merge my GRXML files. Yuck. There’s a reason for ruleref support in the files. In addition, the app is meant to be extensible, and having to merge files just makes things harder for the developer and end users.
- Go down the path of using SpeechLib/SAPI, but looking at the amount of code in the Framework, this seems totally redundant.
Error Info
- SapiErrorInvalidImport A rule reference to an imported grammar cannot be resolved.
- SAPIErrorCodes.SPERR_INVALID_IMPORT
- 0x80045024
- -2147200988
269c9cd9-25a6-403a-a3ca-445cd410087d|1|5.0|96d5b379-7e1d-4dac-a6ba-1e50db561b04
UPDATE: Nevermind, this is a patch for the "es-us" culture which has the ID 0x540A.
I been trying to track down why I can’t get GRXML files that have ruleref elements pointing to external files working with Windows 7 (64-bit), and ran into the following line of code:
culture = (backend.LangId == 0x540a) ? new CultureInfo("es-us") : new CultureInfo(backend.LangId);
Note the "es-us" locale. Weird. Now back to banging my head against the original problem.
9e1c68f0-e059-47b0-9c24-eccb029d3ae1|0|.0|96d5b379-7e1d-4dac-a6ba-1e50db561b04
I know I’ve seen the solution to this one somewhere, but if you’re getting the following error on a 64-bit platform, the solution is to set your application to compile as “x86” and not “Any CPU”:
ERROR: 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine.

77314392-ad14-4169-ba45-82d9798374b1|1|4.0|96d5b379-7e1d-4dac-a6ba-1e50db561b04
There have been several people requesting help using the Yahoo! Address Book web services in the .NET Developer Forum. People are getting 403 or 404 error codes back.
I did some digging into the issue this morning and the cause for the 404 error turns out to be an invalid URL for the DOCTYPE declaration for the returned XML data. In short the URL http://l.yimg.com/a/lib/pim/r/abook/xml/2/pheasant.dtd set as the DOCTYPE for the resulting successful web service call XML data is invalid.
This causes problems when using the Yahoo.Authentication class methods, such as GetAuthenticatedDataSet(), resulting in a 404 when the .NET XmlReader attempts to validate the data against the DTD.
The way to work around this issue is to use your own XmlReader with custom XmlReaderSettings specifying to ignore the DTD.
More...
2f7f47f8-aee8-4642-acc5-ba4db19fec55|1|5.0|96d5b379-7e1d-4dac-a6ba-1e50db561b04
One big surprise for me was that out of browser support made it into version 3. While it is nowhere near as comprehensive as Adobe Air, its main advantages are that users don’t need a separate runtime download and for developers the programming model is pretty much the same for in and out of browser.
View the session.
Installation
Installing a Silverlight application is easy for the user, and making an application available is easy for the developer.
- Shortcuts can be placed on desktop and Start-menu.
- No Control Panel Add/Remove Programs item added (listening to feedback).
- Right-click: Remove this application.
- Multiple icon sizes can be provided. Must be PNGs (transparency supported).
- Install dialog
- Taskbar
- Window
- Applications can be “previewed” in the browser before installation since the application is the same in both the browser and out.
Detaching APIs
“Detaching” is the term of moving (installing) a Silverlight application from browser onto the desktop.
- Manifest
- Name, Title, and Description
- Application icons
- APIs on Application
- Detach method (must be called from a user interaction)
- ExecutionState property
- ExecutionStartChanged event
- RunningOffline property
Updating Applications
- Optimized for “instant on”. No check for “new version” is done when the application starts.
- Silverlight downloads update in the background.
- Next application launch runs the new version.
- Event raised when an update has been downloaded. This lets you prompt the user to restart the application if necessary.
Network Availability
- Network access information is key for out of browser applications
- Silverlight adds functionality
- IP address changed event
- Network availability property
- Any net interface, connected, not looped back
- Best practice is to “ping” server by attempting to download a small file when state changes and a valid IP address exists. There maybe cases where the network is “available”, but limited to the local network (automatically generated private IP address).
Saving Data Locally
- OoB Isolated Storage limit is increased to 25MB
- Limit is increased when the application is detached
- SaveFileDialog
- Allows you to set file types (filter)
- Application gets access to a Stream, but not the path
Details
- HTML DOM Bridge is not available
- Shortcuts point to a small Silverlight host application that contains a browser instance
- LocalLow\Microsoft\Offline\[ApplicationName]
- LocalLow\Microsoft\is\[random]\[random]\[etc…]
- Bundles are used on Macs
Debugging
- Use MessageBox for startup with Application_UnhandledException
- Use Attach to Process on slhost.exe in Visual Studio. Will be improved post beta.
Differences vs. In Browser
- Additional key access (Function keys for example)
- No HTML DOM Bridge
- No mouse wheel
- No XmlHttp
- Currently no HTML interop or rendering.
- Out of browser will currently always have operating system window chrome.
Best Practices
- (See above for network availability testing)
- Download local data in the OoB instance after the application has been detached.
- Check RunningOffline to see if you’re out of browser
- Don’t fire off more than one HWR at a time.
- Keep all your code in the XAP
- Silverlight versions for you making updates easy to manage
- Assets can go outside
- If your data model changes, require a restart.
- Show UI for major updates so user knows things have changed.
Links
Mike Harsh’s Slidentity Silverlight “PowerPoint” application.
MSDN pre-release documentation.
402e4b88-3763-4dd8-92a9-7f19b619b2b2|0|.0|96d5b379-7e1d-4dac-a6ba-1e50db561b04
Here’s a quick rundown (mostly of the slide content) presented by Joe Stegman. View the session.
As I mentioned in my previous post, there were a couple of nice surprises that I didn’t believe wouldn’t make version 3, but in addition to those there are a ton of new features as listed below.
Graphics
- Perspective 3D
- Rotate any visual object by its X/Y/Z axes
- Effects and Pixel Shaders
- Pixel APIs
- Dynamic bitmap generation
- Render a visual tree (elements) to a bitmap
- Image editing and effects
- Clone visuals
- DirectX SDK used to generate
Raw Audio/Video APIs
- Dynamic sound generation
- Custom audio/video decoders
Local Messaging
- Cross plug-in Silverlight communication: cross plug-in/tab/browser/out-of-browser
- Shared memory implementation
- Exposed like "named pipes"
- String based messages only (no byte-based, maybe later based on feedback)
- Same domain required with opt-in
UI Framework Improvements
- Merged Resource Dictionaries
- BasedOn Styles
- Styles can be “cleared”
- Multi-select ListBox
- Listening to “handled” routed events
- New VSM “Invalid” states
- Supported on TextBox, CheckBox, ComboBox, ListBox, RadioButton, PasswordBox (coming later)
Other Improvements
- SystemColors
- Especially useful for “high contrast” settings
- Text Improvements
- ClearType Text (post beta)
- CaretBrush (SL 2 caret was black)
- Flag to optimize for animating text
- Glyphs support for system font
- Image Refinements
- Getting size
- Bypass cache
New SDK Controls
- DockPanel
- Expander
- Label
- etc
Other Big Additions
- Save File Dialog
- Navigation Framework
- “Native” integration with the browser history
- Data Control Additions
- SEO Support
- n-Tier data support
- Binary XML, SOAP faults, Credentials
Out of Browser
- Silverlight runs sandboxed on desktop
- Built into the core Silverlight runtime
- Enabled per “application”
- More storage space by default: 25MB
- User gesture required to take “out of browser”
- Right-click context menu option
- Custom buttons (user action required to trigger event)
- New networking APIs
- Connected, disconnected and changed state
- Available in the browser, too
- Offline APIs
- Launch state, update APIs
- Add icon to install dialog
- “Take a XAP offline” – easy to deploy if everything is in the XAP. Doesn’t have to be.
Miscellaneous
- No printing support.
- No FlowDocument.
- 3 behavior changes that aren’t backwards compatible
- No Commanding support
- Isolated Storage performance problems fixed
c858f1a4-4c68-406a-b381-638b8368a668|0|.0|96d5b379-7e1d-4dac-a6ba-1e50db561b04
Here’s a quick rundown of the items covered during the initial Mix09 keynote. View keynote.
General
SuperPreview
Beta available today.
Allows you to compare the rendering of a web page in different browsers. Supports both local installations of browsers and a cloud-based service to render in other browsers.
Read more on the Expression Blog.
ASP.NET MVC 1.0
Shipping today.
http://www.asp.net/mvc/
http://www.codeplex.com/aspnet
ASP.NET 4 and VS 2010
Even better IDE for C#/VB and web developers.
Web Platform Installer
http://www.microsoft.com/web/
Version 2.0 beta available today. Now allows web applications to be installed along with any dependencies.
Azure
- FastCGI/PHP and .NET full trust
- SQL Data Services
- .NET Services
Commercial release this year.
Silverlight 3
Two surprises from left-field: Out of Browser and Multitouch support!
Current Numbers
- 350+ million installations
- 300,000 Developers & Designers
- 200+ partners worldwide
- 200+ Microsoft Products and Websites
- 10,000’s of apps globally
Silverlight 3 Media Enhancement
- GPU hardware acceleration
- New codec support (H.264, AAC, MPEG-4)
- Raw bitstream Audio/Video API, use .NET to access stream data
- Improved logging for media analytics
IIS Media Services
- Free for IIS
- On-demand smooth streaming
- Live smooth streaming
- Edge caching
- Web playlists
- Bit-rate throttling
- Advanced logging
Silverlight 3 Graphics
- GPU acceleration and hardware compositing
- Perspective 3D
- Bitmap & pixel API
- Pixel shader effects
- Deep Zoom improvements
Application Development
- Deep linking, navigation and SEO
- Improved text quality (ClearType)
- Multi-touch support
- 100+ controls available
- Library caching support (finally! Like a Global Assembly Cache for Silverlight)
- Eclipse Support for Silverlight (on the Mac)
Silverlight 3 Data
- Data-binding improvements
- Validation error templates
- Server data push improvements
- Binary XML networking support
- Multi-Tier REST data support
Out of Browser
Run Silverlight applications on the desktop for both Windows and Mac.
- Extend media experiences
- Companion applications for your website
- Lightweight data snacking applications
- Simple consumer friendly experience
- Safe, secure, sandboxed environment
- Built-in auto-update support
- Build offline-aware applications
- Integrate with underlying operating systems
Download Size
Total size: ~4.4MB. 40k smaller than Silverlight 2!
- Thousands of new APIs
- Hundreds of new features
- New codecs
- Out of browser support
SHIP DATE
- Single beta planned
- Ship later this year
- Silverlight 3 Beta
- Expression Blend 3 Preview
- Silverlight 3 Tools for Visual Studio 2008
- IIS Media Services
Expression Blend 3
Be sure to watch the keynote by Bill Buxton. Great energy and view on design.
View keynote
View Interview
http://www.billbuxton.com/
- SketchFlow
- Flow diagram for different parts of an application.
- “Wiggly” controls. Working controls that look like conceptual prototypes.
- Free viewer application to view “sketches”.
- Supports multiple options.
- Supports displaying transitions with animations.
- Supports giving feedback. Notes and drawing on the sketches directly. Send to Blend and view in context.
- Export to Word to auto-generate documents for clients.
- Adobe Photoshop and Illustrator import
- Behaviors
- Designing with data
- Source code controls
- XAML, C# and VB code Intellisense
a76d2409-bc40-4e02-99be-641e16d83d78|0|.0|96d5b379-7e1d-4dac-a6ba-1e50db561b04
I just added the source code that Drew requested to the Downloads page.
e83ac803-3565-4de3-8fbb-2edf14ba5020|0|.0|96d5b379-7e1d-4dac-a6ba-1e50db561b04
I was playing around with the WCF REST Starter Kit CodePlex Preview 1 package and had some problems getting the Visual Studio 2008 templates installed correctly. Someone suggested running MSIEXEC with elevated permissions, but in the end I did the following:
- Run the setup, let the add-in installer crash closing any debug requests and such.
- Open the installation directory, such as C:\Program Files (x86)\WCF REST Starter Kit\Visual Studio Templates Installer.
- Double-click on RESTStarterKit.vsi and follow the instructions.
I still haven’t got the item templates to show up as expected. I noticed they got installed under Documents\Visual Studio 2008\Templates\ItemTemplates\Visual Web Developer instead of Visual C#, but moving them didn’t fix the issue.
b4716367-3172-4a98-a5c0-b3940aed5baf|0|.0|96d5b379-7e1d-4dac-a6ba-1e50db561b04
I’ve added a new tool to the downloads page called On The Fly .NET. It’s a simple utility that lets you type in C# or VB.NET and run it. I use it mainly to test little snippets of code and for writing samples when I want to make sure they actually compile (and possibly run). It has basic syntax highlighting and code completion so it makes it easier to test things or check the name of a property/method.
I haven’t done any thorough testing, but you’ll need at least .NET 2 and might need 3 since it currently imports some of the base WPF classes.
To output a result, you can simply use Console.Write()/WriteLine() and the content will be displayed in a separate window. It’ll remember some basic settings such as the code you last typed. You’ll need the Main function to exist as that will be the starting point of the dynamically compiled application, but you can always get the default template in the correct language which contains the required stub code by clicking New….
7c000188-e7ca-48cb-ad52-38a2be2e5cc8|0|.0|96d5b379-7e1d-4dac-a6ba-1e50db561b04