views:

821

answers:

3

So I know now that the debug assemblies have been intentionally left out of the Silverlight runtime to save space. For that reason I get good detailed error messages on my local machine that has the Silverlight SDK on it, but I don't on a computer with the runtime only. I get the ubiquitous, "Debugging resource strings are unavailable."

Unfortunately my requirements are a bit unique. I need to include the debug assembly (not sure which one yet) that will give me details of a regular expression error. And so essentially I want to include the dll in the xap if I can.

The problem is that I can't seem to do this. I've tried adding the debug dll's as references and setting them to "copy local." And I've tried adding them into the project as content. But in fact, with either method the xap hardly grows in size and the error message doesn't change.

Any ideas?

+2  A: 

You'll still need the actual Silverlight Developer Runtime to be installed (thus you get the errors etc on the machine you had the SDK installed on). Adding the debug assembly into a production solution and accessing it via the non-developer runtime isn't possible.

Scott Barnes / Rich Platforms Product Manager / Microsoft.

Scott Barnes
Thanks Scott. That's what I was beginning to think. I suppose the one other option is to perform a try/catch around the regex, and then if there's an error then send the regex to a web service that then replies with the error details. It's not exactly my idea of the perfect solution, but I may do something like that.If I do all of that asynchronously it should still make for a decently responsive UI experience. By the way, this is all for www.regexhero.comThanks again,Steve
Steve Wortham
Is this still a limitation with Silverlight 3.0 and Silverlight 4.0? I ask, because it becomes a problem when doing validation as these strings are sometimes used in the ValidationSummary control.
Scott
A: 

So my solution to the problem was essentially to give up on what I was trying to do. Instead, I'm now calling a web service whenever an exception occurs around the regex. That web service has a function I made called GetRegexError.

Here's the code for it:

<WebMethod()> _
Public Function GetRegexError(ByVal strRegex As String, ByVal _regexOptions As RegexOptions) As String
    Try
     Dim _regex As New Regex(strRegex, _regexOptions)
    Catch ex As Exception
     Return ex.Message
    End Try

    Return ""
End Function

This is now implemented in Regex Hero. Thank you Scott for the help.

Steve Wortham
A: 

Hi Scot, I'm facing this problem now and if I don't have a solution at server side. Every client'll need to install Silverlight Developer Runtime manually So I think it's not good solution.

@Steve: If can, please post your example solve this problem here.

Thanks.

nikitakova
My answer is right above (or below) yours.
Steve Wortham