I've an application build with C# and WPF, that is being developed by 3 developers, including me.
On a certain stage of the application, an error came up that we can't determine how it happened and how to solve it, so we ask for your help.
Although everything works well when compiling, and running the aplication, we can't see the window in design view. Instead we have the following error message on the Visual Studio IDE:

"An Unhandled Exception has occurred

Click here to reload the designer

startIndex cannot be larger than length of string.
Parameter name: startIndex
at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
at MS.Internal.Host.PersistenceSubsystem.ExtractSourceFileInfo(Uri uri)
at MS.Internal.Host.PersistenceSubsystem.FormatInnerXamlParseException(Exception ex)
at MS.Internal.Host.PersistenceSubsystem.ReportException(Exception ex, TextModel model, Int64 sourceVersion)
at MS.Internal.Host.PersistenceSubsystem.Load()
at MS.Internal.Host.Designer.Load()
at MS.Internal.Designer.VSDesigner.Load()
at MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedView.Load()
at MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedDesignerFactory.Load(IsolatedView view)
at MS.Internal.Host.Isolation.IsolatedDesigner.BootstrapProxy.LoadDesigner(IsolatedDesignerFactory factory, IsolatedView view)
at MS.Internal.Host.Isolation.IsolatedDesigner.BootstrapProxy.LoadDesigner(IsolatedDesignerFactory factory, IsolatedView view)
at MS.Internal.Host.Isolation.IsolatedDesigner.Load()
at MS.Internal.Designer.DesignerPane.LoadDesignerView(Boolean isReload)"

We've tried to see if we could solve this using Expression Blend, but apparently everything is ok in Blend. We can see the window (although the programmers aren't using blend, so we need it to work in Visual Studio). I've installed SharpDevelop to see i the problem could be solved from it, but Sharpdevelop shows the window as a grey window, without any objects on it and has the following output:

The target "ResolveAssemblyReferences" does not exist in the project.

and when building gives the following output:

Build started.
Warning MSB3247: Found conflicts between different versions of the same dependent assembly.
Build finished successfully.

We've been googling and trying several workarrounds but we haven't found the solution.
Can you please help?

My thanks in advanced

Is it just one Window that is doing this, or all? If it is just one, you could try removing everything from the XAML file (keep a copy somewhere else of course) and re-add everything piece by piece to see when the error arises. I remember getting something similar, but I can't remember what the exact exception was, or how I resolved it...

This article has been dead for over six months. Start a new discussion instead.