Error MSB6006: "sgen.exe" exited with code -1 (since stable update last Tuesday)

HugoLogmans_HugoLogmans_ Hugo LogmansNLMember ✭✭✭

Hi all,

anybody a solution to the below problem? Since last update I cannot build a specific iOS project in release mode anymore, for a single project. Also in XS it won't build anymore. Colleagues who have the latest XS but not VS updated to the latest version can build it. One colleague who also has the latest VS update cannot build the project with the same exception. I tried reverting the project to a version that absolutely did work in the past (last monday) but that also does not help.

(Osx Sierra 10.12.4, latest xcode, latest stable XS/VS updates, Linking against 10.3)

  • Link options do not matter
  • I tried setting all the same settings as Debug (that works), but it does not matter.

Exception details:

Unhandled Exception:
System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (System.Reflection.Assembly,bool)
at System.Reflection.Assembly.GetTypes () [0x00000] in :0
at Driver.Run (System.String[] args) [0x000f9] in :0
at Driver.Main (System.String[] args) [0x00005] in :0
[ERROR] FATAL UNHANDLED EXCEPTION: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.

For clarity, this exception occurs in sgen.exe.

Task Parameter:ShouldGenerateSerializer=True
Task Parameter:UseProxyTypes=True
Task Parameter:UseKeep=False
Task Parameter:SerializationAssembly=obj/iPhone/Release/MijnOverheid.BerichtenBox.iOS.XmlSerializers.dll
Task attempted to find "sgen.exe" using the SdkToolsPath value "". Make sure the SdkToolsPath is set to the correct value and the tool exists in the correct processor specific location below it.

On my own mac with the latest builds it builds in XS, but not in VS. That's nice for a comparison:

WORKING version details:
Xamarin Studio Community
Version 6.3 (build 864)
Installation UUID: 515a30df-9429-43e9-ac85-7e6f41d14840
Runtime:
Mono 5.0.1.1 (2017-02/5077205) (64-bit)
GTK+ 2.24.23 (Raleigh theme)

    Package version: 500010001

NuGet
Version: 3.5.0.0

Xamarin.Profiler
Version: 1.5.4
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

Apple Developer Tools
Xcode 8.3.2 (12175)
Build 8E2002

Xamarin.Mac
Version: 3.4.0.36 (Xamarin Studio Community)

Xamarin.iOS
Version: 10.10.0.36 (Xamarin Studio Community)
Hash: d2270eec
Branch: d15-2
Build date: 2017-05-22 16:30:53-0400

Xamarin Inspector
Version: 1.2.2
Hash: b71b035
Branch: d15-1
Build date: Fri, 21 Apr 2017 17:57:12 GMT

Xamarin.Android
Version: 7.3.1.2 (Xamarin Studio Community)
Android SDK: /Users/hugologmans/Library/Developer/Xamarin/android-sdk-macosx
    Supported Android versions:
        4.0.3 (API level 15)
        5.0   (API level 21)
        6.0   (API level 23)
        7.1   (API level 25)

SDK Tools Version: 25.2.5
SDK Platform Tools Version: 25.0.4
SDK Build Tools Version: 25.0.1

Java SDK: /usr
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Build Information
Release ID: 603000864
Git revision: 6c2f6737278ccc3e81e12276d49c0d92f975f189
Build date: 2017-04-24 11:26:01-04
Xamarin addins: d8d46e577d8507c35260ce9d73df3c33415bb214
Build lane: monodevelop-lion-d15-1

Operating System
Mac OS X 10.12.5
Darwin MacBook-Pro-van-Hugo.local 16.6.0 Darwin Kernel Version 16.6.0
    Fri Apr 14 16:21:16 PDT 2017
    root:xnu-3789.60.24~6/RELEASE_X86_64 x86_64

Enabled user installed addins
MFractor 2.10.06

NOT WORKING VERSION DETAILS:
Xamarin Studio Community
Version 6.3 (build 864)
Installation UUID: 515a30df-9429-43e9-ac85-7e6f41d14840
Runtime:
Mono 5.0.1.1 (2017-02/5077205) (64-bit)
GTK+ 2.24.23 (Raleigh theme)

    Package version: 500010001

NuGet
Version: 3.5.0.0

Xamarin.Profiler
Version: 1.5.4
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

Apple Developer Tools
Xcode 8.3.2 (12175)
Build 8E2002

Xamarin.Mac
Version: 3.4.0.36 (Xamarin Studio Community)

Xamarin.iOS
Version: 10.10.0.36 (Xamarin Studio Community)
Hash: d2270eec
Branch: d15-2
Build date: 2017-05-22 16:30:53-0400

Xamarin Inspector
Version: 1.2.2
Hash: b71b035
Branch: d15-1
Build date: Fri, 21 Apr 2017 17:57:12 GMT

Xamarin.Android
Version: 7.3.1.2 (Xamarin Studio Community)
Android SDK: /Users/hugologmans/Library/Developer/Xamarin/android-sdk-macosx
    Supported Android versions:
        4.0.3 (API level 15)
        5.0   (API level 21)
        6.0   (API level 23)
        7.1   (API level 25)

SDK Tools Version: 25.2.5
SDK Platform Tools Version: 25.0.4
SDK Build Tools Version: 25.0.1

Java SDK: /usr
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Build Information
Release ID: 603000864
Git revision: 6c2f6737278ccc3e81e12276d49c0d92f975f189
Build date: 2017-04-24 11:26:01-04
Xamarin addins: d8d46e577d8507c35260ce9d73df3c33415bb214
Build lane: monodevelop-lion-d15-1

Operating System
Mac OS X 10.12.5
Darwin MacBook-Pro-van-Hugo.local 16.6.0 Darwin Kernel Version 16.6.0
    Fri Apr 14 16:21:16 PDT 2017
    root:xnu-3789.60.24~6/RELEASE_X86_64 x86_64

Enabled user installed addins
MFractor 2.10.06

Answers

  • VernonChinVernonChin Vernon Chin CAMember ✭✭

    Same/similar issue: sgen.exe does not work for me, when I try to build a project with a web reference. This is not happening on Xamarin Studio, but I do not believe sgen is being run because it is not showing up as one of the build tasks.

    There is additional discussion here: https://stackoverflow.com/questions/44331067/sgen-typeloadexception-in-visual-studio-for-mac-when-trying-to-build-xamarin-ios

    where someone mentioned that turning GenerateSerializationAssemblies off also does not work in VS4Mac.

  • HugoLogmans_HugoLogmans_ Hugo Logmans NLMember ✭✭✭

    I can confirm this project had a web reference. I changed the code so it was not used as a web reference anymore and the error went away. Strange.

  • voidvoid Tim A. DKBeta ✭✭✭
    edited June 27

    Same issue.

    See possible related issue https://forums.xamarin.com/discussion/93991/unable-to-generate-a-temporary-class-in-release-mode

    Building with xbuild as suggested in the link "fixed" the problem for me

    @Xamarin: Do we have an inbound fix ?

  • SuatKorkmazSuatKorkmaz Suat Korkmaz USMember ✭✭✭

    @HugoLogmans_ said:
    I can confirm this project had a web reference. I changed the code so it was not used as a web reference anymore and the error went away. Strange.

    Yup. My project had a web reference too and I was getting this error until I deleted it.

  • SuatKorkmazSuatKorkmaz Suat Korkmaz USMember ✭✭✭

    Does anyone have a workaround for this?

  • HugoLogmans_HugoLogmans_ Hugo Logmans NLMember ✭✭✭

    @SuatKorkmaz I deleted the reference as web reference and readded the code as a normal reference.

    In another case I hit this error, it was because of old binary dll's that were included in the project. When rebuilding them the problem went away.

  • SuatKorkmazSuatKorkmaz Suat Korkmaz USMember ✭✭✭

    @HugoLogmans_ said:
    @SuatKorkmaz I deleted the reference as web reference and readded the code as a normal reference.

    In another case I hit this error, it was because of old binary dll's that were included in the project. When rebuilding them the problem went away.

    Makes sense.

Sign In or Register to comment.