VS: Sgen error and Fusion Log Viewer

Some SGEN errors:

If you in Visual Studio get the error (while building release):

SGEN : error : Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

Then read about it here: http://hashtagfail.com/post/5255977780/sgen-loaderexceptions-error


 … and further about Fusion Log Viewer: http://www.hanselman.com/blog/BackToBasicsUsingFusionLogViewerToDebugObscureLoaderErrors.aspx

The Fusion Log Viewer is started from a VisualStudio Cmd prompt: > Fuslogvw.exe

  • Set  some setttings:
    • Log to disk e.g. c:\log\fusion
    • Log all binds
  • Next do > iisreset
  • and re-do your test case

If you in Visual Studio get the error (while building release):

SGEN : error : Cannot generate serialization assembly xxx.XmlSerializers.dll because it already exists. Use /force to force an overwrite of the existing assembly.

Then put following in your pre-build event:

del $(ProjectDir)$(TargetName).XmlSerializers.dll

or you can turn off SGEN as explained in http://hashtagfail.com/post/5255977780/sgen-loaderexceptions-error

Advertisements

One Comment

Add yours →

  1. Adding the del command to my Pre-build events worked for me, but I had to enclose the directory in quotes (because I have spaces in the directory names).
    del “$(ProjectDir)$(TargetName).XmlSerializers.dll”

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: