Diagram in VB.NET


I was trying to convert my code from C# to VB.NET and to use Silverlight 4. The code is running on C# but on VB.NET it is producing an exception. Here is my C# code:
public void LoadXML(object o, GraphServiceReference.LoadXMLDataCompletedEventArgs e) { xml = e.Result; // App.Current.Resources.Add("xmlFileContent", xml); var model = new GraphLinksModel<State, String, String, Transition>();

model.Load<State, Transition>(XElement.Parse(xml), “State”, “Transition”);
model.Modifiable = true;
model.HasUndoManager = true;
myDiagram.Model = model;

My VB.NET code:
Public Sub LoadXML(ByVal o As Object, ByVal e As LearningProgressionService.LoadXMLDataCompletedEventArgs) xml = e.Result Dim model = New GraphLinksModel(Of State, String, String, Transition)() Dim root As XElement = New XElement(XElement.Parse(xml)) model.Load(Of State, Transition)(root, "State", "Transition") model.Modifiable = True model.HasUndoManager = True
myDiagram.Model = model
End Sub
The exception is produced on the above underlined line.
"An exception of type 'System.Exception' occurred in System.Windows.dll but was not handled in user code
Additional information: Error HRESULT E_FAIL has been returned from a call to a COM component."
Is there anything wrong in my VB.NET code or should I add some new files for Silverlight 4? Please advice

A minor difference is that in VB you are doing new XElement(XElement.Parse(…)) instead of just XElement.Parse(…).

Also I notice the change from GraphServiceReference to LearningProgressionService, which I assume was intentional.

But I suspect that the problem is not in this code at all. Are you sure all of the templates are exactly the same as before in C#? Or do they need to be different because of changes you have made to design of the code?

Unfortunately, debugging exceptions in Silverlight can require a lot of tedious trial and error trying to find the thing that is wrong.

The name of the service is not the error because in vb.net solution i’ve changed it. I did XElement.Parse() but still facing the same error.

What I've done is that I've started a new solution Silverlight application in vb.net and i've added the dll of Northwoods.GoSilverlight.dll and translated the code. What else should i do?
I'm working on Silverlight 4 but the Northwoods.GoSilverlight is
Is there any problem with the dll version on Silverlight 4?

Which version of Silverlight 4? We’re about to release a kit that works with Silverlight 4 RTM. (Still some bugs to be squashed, and regression testing to be done.)

The current beta kits are GoSilverlight version 1.1.1.x, which are newer than what you are using. It wouldn’t hurt to use 1.1.1 beta instead of 1.1.0 beta. But if you’re using Silverlight 4 RTM, I know there are problems with printing.

Still, I don’t know of any problems that you would be encountering now by using the old beta DLL that targets Silverlight 3 instead of Silverlight 4.

To summarize: try using the GoSilverlight1114.msi beta kit, which targets Silverlight 4 RC.