tags:

views:

27

answers:

3
+2  Q: 

WPF error CS0433

Hi,

I'm getting this error in my WPF application. I get this error not always. If I make Clean and then Rebuild everything is ok.

SGEN (0,0):                                             
error: Unable to generate a temporary class (result=1).

SGEN (0,0):
errorCS0433: The type 'XamlGeneratedNamespace.GeneratedInternalTypeHelper' exists in both 'library1.dll' and 'library2.dll'
A: 

Here's an article by Scott Hanselman discussing this issue for WPF.

Other people that have had this problem have fixed it by installing some hotfixes. Check out this article for more information.

If you're using Citrix, you might want to check this out. You could have a permissions issue. This particular article deals with an ASP .NET application, but you might have a similar issue in your WPF application. It's a good place to start.

Robert Greiner
I don't use Citrix. Not sure whether it because of hotfixes provided in mentioned article. I got this error only today. It worked perfect for several month.
Pashec
A: 

This error comes from the persistent compiled XML serialization assembly generator. It generates classes from XML serializable types. If you don't use this, you can uncheck this in project properties.

codekaizen
In one project I don't use XML serialization assembly generator so I disable it. It helped. But I'm still curious why it happened and how to fix it if I would need to run sgen in both projects.
Pashec
A: 

I tried to figure out why I've got this generated class XamlGeneratedNamespace.GeneratedInternalTypeHelper in my library. MSDN says nothing helpful:

A class generated by the workflow designer used to generate CLR types for XAML documents.

But I found the line of code which causes generation of this class:

<Grid DataContext="{TemplateBinding InternalDataContext}">

I replaced it with "runtime equivalent":

<Grid DataContext="{Binding InternalDataContext, RelativeSource={RelativeSource TemplatedParent}}">

Maybe it may help somebody.

Pashec