10

Resolved

VS2010 is throwing an Invalid XmlnsDeclaration occurs in assembly 'Expression.Samples.PathListBoxUtils' error.

description

Visual Studio 2010 is throwing the following error on a project with the PathListBoxUtils library included:
 
Error 1 Invalid XmlnsDeclaration occurs in assembly 'Expression.Samples.PathListBoxUtils, Version=4.0.0.0, Culture=neutral, PublicKeyToken=76319f7ba805fb35'. XmlnsDeclaration references a namespace 'PathListBoxUtils' that is not in the assembly.
 
The assembly was added to the project in Blend 4.
 
This is causing several problems inside of VS2010. The Designer fails to load and contains the following stack trace:
 
System.NullReferenceException
Object reference not set to an instance of an object.
at MS.Internal.Design.Metadata.ReflectionProjectNode.ProcessAssemblyNamespaces(Dictionary2 namespaces, AssemblyNode assembly)
at MS.Internal.Design.Metadata.ReflectionProjectNode.BuildNamespaces()
at MS.Internal.Design.Metadata.ReflectionProjectNode.EnsureState()
at MS.Internal.Design.Metadata.ReflectionProjectNode.Find(Identifier namespaceUri)
at Microsoft.Windows.Design.XamlLanguageService.<>c__DisplayClass6.<>c__DisplayClass8.<PrefetchAttachedAttributes>b__5(Object state)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
 
It is also causing intellisense in XAML to throw the following exception constantly:
 
System.AppDomainUnloadedException: Attempted to access an unloaded AppDomain. at Microsoft.Windows.Design.IXamlCompletion.get_Name() at MS.Internal.XamlLanguageService.XamlDeclarationsAdapter.GetName(Int32 index) at Microsoft.VisualStudio.Package.CompletionSet.OnCommit(String textSoFar, Int32 index, Int32 selected, UInt16 commitChar, String& completeWord) at Microsoft.VisualStudio.Editor.Implementation.ShimCompletion.TryCommit(Nullable
1 queryCommitChar, Boolean isSelected) at Microsoft.VisualStudio.Editor.Implementation.ShimCompletionController.TryCommit(Nullable1 commitChar) at Microsoft.VisualStudio.Editor.Implementation.ShimCompletionController.PreProcessCommand(Guid& pguidCmdGroup, UInt32 nCmdID, IntPtr pvaIn, IntPtr pvaOut) at Microsoft.VisualStudio.Editor.Implementation.IntellisenseCommandFilter.Exec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) at Microsoft.VisualStudio.Editor.Implementation.CommandChainNode.Exec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) at Microsoft.VisualStudio.Editor.Implementation.CommandFilterWrapper.Exec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) at Microsoft.VisualStudio.Editor.Implementation.CommandChainNode.Exec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) at Microsoft.VisualStudio.Editor.Implementation.CommandFilterWrapper.Exec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) at Microsoft.VisualStudio.Editor.Implementation.CommandChainNode.Exec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) at Microsoft.VisualStudio.Package.ViewFilter.InnerExec(Guid& guidCmdGroup, UInt32 nCmdId, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) at Microsoft.VisualStudio.Package.ViewFilter.ExecCommand(Guid& guidCmdGroup, UInt32 nCmdId, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) at MS.Internal.XamlLanguageService.VsXamlLanguageService.XamlViewFilter.ExecCommand(Guid& guidCmdGroup, UInt32 nCmdId, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) at Microsoft.VisualStudio.Package.ViewFilter.Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget.Exec(Guid& guidCmdGroup, UInt32 nCmdId, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) at Microsoft.VisualStudio.Editor.Implementation.CommandChainNode.Exec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) at Microsoft.VisualStudio.Editor.Implementation.CommandFilterWrapper.Exec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) at Microsoft.VisualStudio.Editor.Implementation.VsTextViewAdapter.Exec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) at Microsoft.VisualStudio.Editor.Implementation.VsKeyboardFilter.SendCommand(Guid cmdGroup, UInt32 cmdID, Object inParam) at Microsoft.VisualStudio.Editor.Implementation.VsKeyboardFilter.TextInput(TextCompositionEventArgs args) at Microsoft.VisualStudio.Text.Editor.Implementation.KeyProcessorDispatcher.<DispatchTextInputEvents>b__0(KeyProcessor p, TextCompositionEventArgs args) at Microsoft.VisualStudio.Text.Editor.Implementation.KeyProcessorDispatcher.<>c__DisplayClass1e1.<Dispatch>b__1a() at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.CallExtensionPoint(Object errorSource, Action call)
 
Occasionally, this last error will cause VS2010 to crash.
 
None of these errors prevent the code from compiling and running correctly.

comments

aguerot wrote Aug 17, 2010 at 8:42 AM

I have tracked down the cause of this error. AssemblyInfo.cs references the following lines:
[assembly: XmlnsDefinition("clr-namespace:PathListBoxUtils;assembly=PathListBoxUtils", "PathListBoxUtils")]
[assembly: XmlnsPrefix("clr-namespace:PathListBoxUtils;assembly=PathListBoxUtils", "plbUtils")]

However, both namespace and assembly are not correct, this cause intellisense in XAML to errors as described above.

GeekByChoiCe wrote Aug 22, 2010 at 8:04 AM

So, How do we fix that?
Its very annoying that the whole intellisense is fucked.
Only work around is writing faster than VIsual Studio can open the intelisense?

orldev wrote Aug 25, 2010 at 1:11 PM

Ok this is beyond annoying...i cant get to my design surface. the impact should be raised to high, low is a joke.

jigas wrote Aug 30, 2010 at 12:56 PM

Yes, this problem avoids normal usage of PathListBoxUtils library! I've disigned an animation using PathListBox in Blend 4 but I had to abandon it while developing the project in VS2010.
I support the idea to rise the impact to high... but most important is to see some progress on the fix...

aguerot wrote Sep 1, 2010 at 8:48 AM

While the issue is fixed in the main branch; as a workaround you can remove these two lines from assemblyinfo.cs and recompile the library in order to be able to use it in VS 2010:

[assembly: XmlnsDefinition("clr-namespace:PathListBoxUtils;assembly=PathListBoxUtils", "PathListBoxUtils")]
[assembly: XmlnsPrefix("clr-namespace:PathListBoxUtils;assembly=PathListBoxUtils", "plbUtils")]

f4tb0y wrote Oct 28, 2010 at 4:12 PM

Could really do with a fix for this as it mean VS2010 is unusable if this is referenced

Diesel wrote Dec 8, 2010 at 6:46 PM

I tried the workaround however the two lines as listed from the assemplyinfo.cs:

[assembly: XmlnsDefinition("clr-namespace:PathListBoxUtils;assembly=PathListBoxUtils", "PathListBoxUtils")]
[assembly: XmlnsPrefix("clr-namespace:PathListBoxUtils;assembly=PathListBoxUtils", "plbUtils")]

aren't in the assemblyinfo.cs..... Am I looking in the wrong place?

Thanks

Diesel wrote Dec 10, 2010 at 1:45 AM

Thanks for the link aguerot!
I did as you suggested and the workaround works in VS2010
Thanks again!

joamason wrote Dec 22, 2010 at 9:55 PM

I fixed the AssemblyInfo.cs issue and put up a new release. Sorry it took me so long to get to this one, I didn't have my notifications set up for CodePlex so I wasn't seeing the comments.

Joanna

oscar_agreda wrote Apr 7, 2011 at 8:48 PM

I fixed it

1-Download the samples from here http://expressionblend.codeplex.com/SourceControl/list/changesets
2-you will find Expression.Samples.PathListBoxUtils.sln, open it, and build
3-Go to the folder ....\Expression.Samples.PathListBoxUtils\Expression.Samples.PathListBoxUtils\obj\Silverlight\V4.0\Debug
4-you will see Expression.Samples.PathListBoxUtils.dll
5-Rename it to PathListBoxUtils.dll
6-add that (Renamed) DLL to your Silverlight project..
7-That is it.. Visual Studio 2010 won't crash anymore when you try to use Intellisense on XAML pages

Regards