Error: Mixed mode assembly

This forum is for programmers who have questions about the source code.

Error: Mixed mode assembly

Postby drtech » Tue Oct 04, 2011 3:02 pm

I am having trouble getting past this error building 11.1

I read the info at http://www.opendental.com/manual/sourcecode.html

it says

Error: Mixed mode assembly etc. We have already altered the app.config file for the Open Dental project to handle one of these errors. If you look closely at the remaining error, the filename is SGEN, which is an MS exe that generates a serialization assembly. The quick fix for this error is to right click the OD project, properties, build tab, and at the bottom, change 'generate serialization assembly' to off. This will, however, result in Open Dental running a little slower. A better fix is to find the sgen.exe, for example at "C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\sgen.exe. Once you find it, create (or possibly alter) an sgen.exe.config to look like this:
<?xml version ="1.0"?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0.30319"/>
</startup>
</configuration>


I found my sgen.exe.config file in C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin since it is 64bit. The file was write protected, so I unprotected it, changed the file to the above specifications and tried to build again.

There was no change and I still got the same error: (need to write protect it again? I will try that...)

Error 33 Mixed mode assembly is built against version 'v1.1.4322' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information. C:\svn\beta\OpenDental\SGEN OpenDental

I am also getting 2 other errors that I have never seen before:
Error 35 Application Configuration file "app.config" is invalid. Could not find file 'C:\svn\beta\ServiceManager\app.config'. C:\svn\beta\ServiceManager\app.config ServiceManager
Is this a missing file from the SVN?

Error 31 Metadata file 'C:\svn\beta\OpenDental\bin\Release\OpenDental.exe' could not be found TestCanada
Is this just because of the other errors and the file is not yet built i suppose?


Using Visual Studio 2010 Pro
David Fuchs
Dentist - Springfield, MO
Smile Dental http://www.887-smile.com
User avatar
drtech
 
Posts: 1601
Joined: Wed Jun 20, 2007 8:44 am
Location: Springfield, MO

Re: Error: Mixed mode assembly

Postby drtech » Tue Oct 04, 2011 3:17 pm

I restarted Visual Studio. Then I write protected the edited file again, and then cleaned the project from within visual studio. When I built again, the SGEN error was resolved!

I still have


Error 33 Application Configuration file "app.config" is invalid. Could not find file 'C:\svn\beta\ServiceManager\app.config'. C:\svn\beta\ServiceManager\app.config ServiceManager


Is this a file that needs to be added to the SVN or is there some other config I am missing?
David Fuchs
Dentist - Springfield, MO
Smile Dental http://www.887-smile.com
User avatar
drtech
 
Posts: 1601
Joined: Wed Jun 20, 2007 8:44 am
Location: Springfield, MO

Re: Error: Mixed mode assembly

Postby drtech » Tue Oct 04, 2011 3:22 pm

Actually, I had turned off the serialization assembly also. When I turned it back on (I think you have to reload the project for this to take effect? I still get the SGEN error.
David Fuchs
Dentist - Springfield, MO
Smile Dental http://www.887-smile.com
User avatar
drtech
 
Posts: 1601
Joined: Wed Jun 20, 2007 8:44 am
Location: Springfield, MO

Re: Error: Mixed mode assembly

Postby jordansparks » Tue Oct 04, 2011 7:10 pm

Yes, it's just a missing file that you don't really need anyway. Just exclude that project from your build.
Jordan Sparks, DMD
http://www.opendental.com
User avatar
jordansparks
Site Admin
 
Posts: 5292
Joined: Sun Jun 17, 2007 3:59 pm
Location: Salem, Oregon

Re: Error: Mixed mode assembly

Postby drtech » Wed Oct 05, 2011 1:41 am

ok, i will exclude that project, but I still can't get it to build with serialization assembly turned on. Any ideas on why the directions on the source code page are not working for me? I don't want it to run slower by leaving serialization off...
David Fuchs
Dentist - Springfield, MO
Smile Dental http://www.887-smile.com
User avatar
drtech
 
Posts: 1601
Joined: Wed Jun 20, 2007 8:44 am
Location: Springfield, MO

Re: Error: Mixed mode assembly

Postby drtech » Wed Oct 05, 2011 2:35 am

i figured it out.

There are mutiple sgen.exe files. I was configuring the first one I found. The one you have to configure is "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools." I was trying to edit it in "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin" as you can see above.

the important thing here is "NETFX 4.0 Tools"

There are also sgen.exe/sgen.exe.config files one directory up, and in x64 folders (which I assume are for 64bit builds, which we don't do)

MAKE SURE YOU ARE CONFIGURING THE RIGHT ONE. Then you can build in serialization.
David Fuchs
Dentist - Springfield, MO
Smile Dental http://www.887-smile.com
User avatar
drtech
 
Posts: 1601
Joined: Wed Jun 20, 2007 8:44 am
Location: Springfield, MO

Re: Error: Mixed mode assembly

Postby beattyph » Thu Jul 05, 2012 9:42 am

I received the following SGEN related error:

Error 39 Could not load file or assembly 'file:///Z:\DataHD\tappuniDental\opendental12.2\Required dlls\CDT.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515) Z:\DataHD\tappuniDental\opendental12.2\OpenDentBusiness\SGEN OpenDentBusiness

I traced this back to the fact that I am accessing the source code from a shared folder & found a solution here:

http://stackoverflow.com/questions/3007190/vsts-2010-sgen-error-could-not-load-file-or-assembly-exception-from-hresult

The sgen.exe.config file can be modified to solve this issue. My sgen.exe.config file looks like

Code: Select all
<?xml version ="1.0"?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0.30319"/>
</startup>
<runtime>
    <loadFromRemoteSources enabled="true" />
</runtime>
</configuration>


Maybe this will help someone facing the same issue.
beattyph
 
Posts: 6
Joined: Sun Nov 08, 2009 5:22 pm

Re: Error: Mixed mode assembly

Postby drtech » Fri Jul 06, 2012 6:20 am

I rebuilt my machine...and now I can't get it to work. Works fine in debug mode, but release gives me sgen errors again...
David Fuchs
Dentist - Springfield, MO
Smile Dental http://www.887-smile.com
User avatar
drtech
 
Posts: 1601
Joined: Wed Jun 20, 2007 8:44 am
Location: Springfield, MO

Re: Error: Mixed mode assembly

Postby drtech » Sun Sep 23, 2012 3:23 pm

installed .net 4.5

created the file sgen.exe.config in C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools with code:

<?xml version ="1.0"?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0.30319"/>
</startup>
</configuration>

Now it works in release mode and debug!
David Fuchs
Dentist - Springfield, MO
Smile Dental http://www.887-smile.com
User avatar
drtech
 
Posts: 1601
Joined: Wed Jun 20, 2007 8:44 am
Location: Springfield, MO

Re: Error: Mixed mode assembly

Postby wjstarck » Sun Sep 23, 2012 7:14 pm

That's great.

Thanks for tracking this down David
Cheers,

Bill Starck, DDS
Big Idea Software, LLC
Developer, EASy(Electronic Anesthesia System) for Open Dental
TX, USA
User avatar
wjstarck
 
Posts: 781
Joined: Tue Jul 31, 2007 7:18 am
Location: Keller, TX

Re: Error: Mixed mode assembly

Postby railgrab » Sat Oct 27, 2012 7:07 pm

Thank you DrTech! I just successfully built v12.3 with my 64 bit Windows 7 machine after installing .net4.5 and adding your sgen.exe.config file. I used Visual Studio Pro 2010.
railgrab
 
Posts: 3
Joined: Thu Oct 18, 2007 12:59 pm

Re: Error: Mixed mode assembly

Postby Justin Shafer » Thu Feb 21, 2013 1:12 pm

Yay! Thanks! Good Job!
User avatar
Justin Shafer
 
Posts: 579
Joined: Sat Jul 28, 2007 7:34 pm
Location: Fort Worth, TX.

Re: Error: Mixed mode assembly

Postby drtech » Thu Feb 21, 2013 2:47 pm

Just figured out in Windows 8 the file path changed slightly

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools
David Fuchs
Dentist - Springfield, MO
Smile Dental http://www.887-smile.com
User avatar
drtech
 
Posts: 1601
Joined: Wed Jun 20, 2007 8:44 am
Location: Springfield, MO

Re: Error: Mixed mode assembly

Postby jackcraig66 » Sat Apr 27, 2013 9:46 am

Thanks to everyone who posted on this subject - very useful info - on my Windows 8 x64 system I had to add (rather than edit) the sgen.exe.config file to C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools - no problem after that :)
jackcraig66
 
Posts: 12
Joined: Tue Apr 09, 2013 12:24 pm

Re: Error: Mixed mode assembly

Postby jsalmon » Fri Aug 30, 2013 3:51 pm

We just updated to Microsoft Visual Studio Professional 2012 and the Mixed mode assembly error happens every time I run Release with Generate serialization assembly turned on (specifically the Open Dental project). However, it doesn't happen when I use VS2010 Pro most likely due to the workaround / settings mentioned above (or in our online manual).
I'm quite baffled and haven't been able to find an explanation on any Microsoft forums. So be cautious when updating to VS2012. I'll post an answer here when I figure out the solution.
The best thing about a boolean is even if you are wrong, you are only off by a bit.

Jason Salmon
Open Dental Software
http://www.opendental.com
User avatar
jsalmon
 
Posts: 1486
Joined: Tue Nov 30, 2010 1:33 pm

Re: Error: Mixed mode assembly

Postby jsalmon » Fri Aug 30, 2013 4:27 pm

So I got it to work but stumbled across it out of a fit of frustration. I decided to see just how many sgen.exe's there were on my computer and create an sgen.exe.config for every single one of them and then after doing that it compiles without an issue. Just to give you guys an idea of what I did:
Created an sgen.exe.config file:
Code: Select all
<?xml version ="1.0"?>
<configuration>
    <startup useLegacyV2RuntimeActivationPolicy="true">
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
    </startup>
</configuration>


Then placed the sgen.exe.config file in every single location that I found an sgen.exe: (note the x86 paths that contain x64 folders!!!) :roll: Come on Microsoft...
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\x64
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\x64
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\x64
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\x64
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin
C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\NETFX 4.0 Tools\x64
C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\NETFX 4.0 Tools
C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\x64
C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin

^^I have no idea which one did the trick nor do I care anymore.
The best thing about a boolean is even if you are wrong, you are only off by a bit.

Jason Salmon
Open Dental Software
http://www.opendental.com
User avatar
jsalmon
 
Posts: 1486
Joined: Tue Nov 30, 2010 1:33 pm

Re: Error: Mixed mode assembly

Postby jordansparks » Tue Sep 03, 2013 2:51 pm

We will add this to our manual.
Jordan Sparks, DMD
http://www.opendental.com
User avatar
jordansparks
Site Admin
 
Posts: 5292
Joined: Sun Jun 17, 2007 3:59 pm
Location: Salem, Oregon

Re: Error: Mixed mode assembly

Postby B.Thomas » Fri Nov 08, 2013 12:03 am

Thanks for the sgen.exe.config tip. I was getting frustrated for a while.
User avatar
B.Thomas
 
Posts: 160
Joined: Mon Jul 23, 2007 11:00 pm

Re: Error: Mixed mode assembly

Postby drtech » Sun May 12, 2019 7:15 pm

Found the new place to add the sgen.exe.config for windows 10 v1810 and visual studio community ed 2019

C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.2 Tools
David Fuchs
Dentist - Springfield, MO
Smile Dental http://www.887-smile.com
User avatar
drtech
 
Posts: 1601
Joined: Wed Jun 20, 2007 8:44 am
Location: Springfield, MO


Return to Developers

Who is online

Users browsing this forum: No registered users and 4 guests