What I'm trying to do at the moment is obfuscate a library referenced by the UI application (winforms.) Just to make sure I also selected enable obfuscation in the windorms app. Didn't help.

I also tried compiling the winforms app using the obfuscated library as a reference, rather than compiling with the original library referenced, and then swapping it with the obfuscated version. That didn't make it work either.

I now also tried using msbuild to see what that did, but still no dice.. library ends up obfuscated as expected but program still crashes with a 'The type initializer for ' ' threw an exception.' exception.

Getting rid of the typeof() 'fixes' the issue so I guess I'll do that and implement a workaround that doesn't make my app crash after obfuscation.

Regardless, can someone please elaborate on how I can properly make PostSharp and SA work together? What do I do with afformentioned .pssym file? Is it auto-used when configuring MSBuild, or? And what happens then when we build using the regular SA application to obfuscate? Or are there additional steps required to use the files either way?

Thanks for your posts. I'm not too familiar with Postsharp I'm afraid- last time it cropped up in conversation here, the general consensus is that you process your assemblies with Postsharp first, then Smartassembly, which I guess you're doing.

I did a quick search through our bugtracker for references to the pssym files but nothing came up, so I don't know if these are something we use or are just a side effect of activating the VS option and aren't needed by us - you may of course be hitting a problem that's not directly related to Postsharp. I did a search for issues surrounding the use of typeof, but nothing came up (although if removing it still works correctly then that's good for now).

I'll try and find out if there's any extra steps needed for postsharp - as I understood, it should "just work", but i'll get some clarification.

OK, further to my last post- we don't use the pssym files at all. Everything that SA requires is in the assembly.
It also sounds like there may be a bug in some instances with Postsharp though, and our developers are liasing with the people at Sharpcrafters in relation to this - so it may be that an update to SA in the future will improve on the compatibility.

james.billings wrote:OK, further to my last post- we don't use the pssym files at all. Everything that SA requires is in the assembly.It also sounds like there may be a bug in some instances with Postsharp though, and our developers are liasing with the people at Sharpcrafters in relation to this - so it may be that an update to SA in the future will improve on the compatibility.

Is there any update on this because I can't get sa to work with postsharp either!