TargetInvocationException occured (SOLVED)

Nov 23, 2009 at 7:45 PM

 Hi guys and girls!

I downloaded Slide.Show 2 and tried the samples. EXACTLY what I've been looking for, great work. :)

Now however I've run into a bump. I've created a .NET 3.5 Web Application project in VS 2008, and in the Default.aspx I've put the following:

<object type="application/x-silverlight-2" data="data:application/x-silverlight-2," width="1000" height="700">
<param name="background" value="#000" />
<param name="source" value="ClientBin/Vertigo.SlideShow.xap" />
<param name="initParams" value="ConfigurationProvider=XmlConfigurationProvider;Path=Configuration.xml,DataProvider=XmlDataProvider;Path=Data.xml;Album=1;SlideIndex=4;" />
<a href="" style="text-decoration: none;"><img src="" alt="Get Microsoft Silverlight" style="border-style: none" /></a>

The Configuration.xml and Data.xml is put in the same dir as Default.aspx and all works when I modify the "XMLConfiguration" sample in the sample project. I've imported all the images (standard and thumbnails) in the directory Assets/GOM and Assets/LAN and they're called in the XML as this (just a snippet):

<?xml version="1.0" encoding="utf-8" ?>
<data startalbumindex="0" transition="CrossFadeTransition">
<album title="BF30 Gallery" description="Pics!" source="Assets/LAN/presentation.jpg" transition="CrossFadeTransition">
<slide title="BF30 #1" description="Foto: Jaggernauten" source="Assets/LAN/1.jpg" thumbnail="Assets/LAN/p1.jpg" />
<slide title="BF30 #2" description="Foto: Jaggernauten" source="Assets/LAN/2.jpg" thumbnail="Assets/LAN/p2.jpg" />
<slide title="BF30 #3" description="Foto: Jaggernauten" source="Assets/LAN/3.jpg" thumbnail="Assets/LAN/p3.jpg" />
When I try to run this in VS2008 I get the following error:
TargetInvocationException occured and was unhandled by user code An exception occurred during the operation, making the result invalid.  Check InnerException for exception details.

The error slams into action on the last row of the below code in the file XMLConfigurationProvider.cs

public void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
			Dictionary<string, Dictionary<string, string>> xmlOptions = new Dictionary<string, Dictionary<string, string>>();
			using (XmlReader reader = XmlReader.Create(new StringReader(e.Result)))

What the heck am I doing wrong? Anyone knows? I've been wrestling with this for the entire afternoon.

Best regards


Nov 23, 2009 at 8:22 PM

If anyone else stumbles upon the same error, here's the solution...

Big ups to the author. :) :)