OnExceptionAspect breaks WinForms designer

Questions about integration in Visual Studio, MSBuild or other IDEs or build tools.

OnExceptionAspect breaks WinForms designer

Postby alansingfield on Tue Dec 04, 2007 12:18 pm


Hello,

I have a WinForms project, with a separate control library, both of which reference a common DLL with an OnExceptionAspect handler.

The windows form contains a user control from the control library. Once I try to open the form in the Designer, this error is shown on the Designer surface:










Unable to cast object of type 'TestAspect1Library.TraceAttribute' to type
'TestAspect1Library.TraceAttribute'.


at
~PostSharp~Laos~Implementation..cctor()



If I remove the PostSharp processing (on both the Form and the UserControl) and recompile, it works correctly.

Alan Singfield
alansingfield
 
Posts: 3
Joined: Sat Jan 12, 2008 4:55 pm
Full Name: Alan Singfield

Re: OnExceptionAspect breaks WinForms designer

Postby alansingfield on Tue Dec 04, 2007 12:21 pm


Example project at:
[url=http://www.didsburysoftware.co.uk/TestAspect1.zip]http://www.didsburysoftware.co.uk/TestAspect1.zip[/url]
Alan Singfield
alansingfield
 
Posts: 3
Joined: Sat Jan 12, 2008 4:55 pm
Full Name: Alan Singfield

Re: OnExceptionAspect breaks WinForms designer

Postby gfraiteur on Tue Dec 04, 2007 1:20 pm

Generally, the error "Unable to cast object of type X to type X." means that two versions of the same assembly have been loaded in the application domain.

Does this help?
Gael Fraiteur, project leader
got good support? consider donating to the project.
gfraiteur
Site Admin
 
Posts: 694
Joined: Tue Dec 18, 2007 3:09 pm
Full Name: Gael Fraiteur
Company: postsharp.org

Re: OnExceptionAspect breaks WinForms designer

Postby alansingfield on Tue Dec 04, 2007 1:41 pm


That would figure; as I have both a WinForms EXE and separate UserControl DLL both referencing the same project. I'll try using a strong name and let you know if that helps.
Alan Singfield
alansingfield
 
Posts: 3
Joined: Sat Jan 12, 2008 4:55 pm
Full Name: Alan Singfield


Return to Integration with IDE and Build Scripts


cron