Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Mizuho · Mar 31, 2013 at 01:32 AM · macosx

Could not load file or assembly System.Drawing

System: Mac OS X 10.8.2 Mountain Lion

A certain project I'm working on requires me to link Unity to Mathematica. It seems like this would likely work with Windows, but a lot of other things rely on Xcode, so I'm unfortunately stuck dealing with the crap hole known as Apple technology.

Here is the error:

 Unhandled Exception:
 Mono.CSharp.InternalErrorException:
 Assets/Popper/Mathematica/LMathematica.cs(14,12):
 LMathematica.LMathematica() ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. File name: 'System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' at (wrapper managed-to-native) System.Reflection.MonoMethodInfo:get_method_info(intptr,System.Reflection.MonoMethodInfo&) at System.Reflection.MonoMethodInfo.GetMethodInfo(IntPtr handle) [0x00000] in :0 at System.Reflection.MonoMethodInfo.GetDeclaringType(IntPtr handle) [0x00000] in :0 at System.Reflection.MonoMethod.get_DeclaringType() [0x00000] in :0 at Mono.CSharp.TypeManager.IsGenericMethodDefinition(System.Reflection.MethodBase mb) [0x00000] in :0 at Mono.CSharp.TypeManager.GetMethodName(System.Reflection.MethodInfo m) [0x00000] in :0 at Mono.CSharp.MemberCache.AddMembers(MemberTypes mt, BindingFlags bf, IMemberContainer container) [0x00000] in :0 at Mono.CSharp.MemberCache.AddMembers(MemberTypes mt, IMemberContainer container) [0x00000] in :0 at Mono.CSharp.MemberCache.AddMembers(IMemberContainer container) [0x00000] in :0 at Mono.CSharp.MemberCache..ctor(IMemberContainer container) [0x00000] in :0 at Mono.CSharp.TypeHandle..ctor(System.Type type) [0x00000] in :0 at Mono.CSharp.TypeHandle.GetTypeHandle(System.Type t) [0x00000] in :0 at Mono.CSharp.TypeHandle.GetMemberCache(System.Type t) [0x00000] in :0 at Mono.CSharp.TypeManager.MemberLookup_FindMembers(System.Type t, MemberTypes mt, BindingFlags bf, System.String name, System.Boolean& used_cache) [0x00000] in :0 at Mono.CSharp.TypeManager.RealMemberLookup(System.Type invocation_type, System.Type qualifier_type, System.Type queried_type, MemberTypes mt, BindingFlags original_bf, System.String name, IList almost_match) [0x00000] in :0 at Mono.CSharp.TypeManager.MemberLookup(System.Type invocation_type, System.Type qualifier_type, System.Type queried_type, MemberTypes mt, BindingFlags original_bf, System.String name, IList almost_match) [0x00000] in :0 at Mono.CSharp.Expression.MemberLookup(Mono.CSharp.CompilerContext ctx, System.Type container_type, System.Type qualifier_type, System.Type queried_type, System.String name, MemberTypes mt, BindingFlags bf, Location loc) [0x00000] in :0    at Mono.CSharp.Expression.MemberLookup(Mono.CSharp.CompilerContext ctx, System.Type container_type, System.Type qualifier_type, System.Type queried_type, System.String name, Location loc) [0x00000] in :0 at Mono.CSharp.MemberAccess.DoResolve(Mono.CSharp.ResolveContext ec, Mono.CSharp.Expression right_side) [0x00000] in :0 at Mono.CSharp.MemberAccess.DoResolve(Mono.CSharp.ResolveContext ec) [0x00000] in :0 at Mono.CSharp.Expression.Resolve(Mono.CSharp.ResolveContext ec, ResolveFlags flags) [0x00000] in :0 at Mono.CSharp.Invocation.DoResolve(Mono.CSharp.ResolveContext ec) [0x00000] in :0 at Mono.CSharp.Expression.Resolve(Mono.CSharp.ResolveContext ec, ResolveFlags flags) [0x00000] in :0 at Mono.CSharp.Expression.Resolve(Mono.CSharp.ResolveContext ec) [0x00000] in :0 at Mono.CSharp.ExpressionStatement.ResolveStatement(Mono.CSharp.BlockContext ec) [0x00000] in :0 at Mono.CSharp.StatementExpression.Resolve(Mono.CSharp.BlockContext ec) [0x00000] in :0 at Mono.CSharp.Block.Resolve(Mono.CSharp.BlockContext ec) [0x00000] in :0 at Mono.CSharp.ToplevelBlock.Resolve(Mono.CSharp.FlowBranching parent, Mono.CSharp.BlockContext rc, Mono.CSharp.ParametersCompiled ip, IMethodData md) [0x00000] in :0    --- End of inner exception stack trace ---   at Mono.CSharp.TypeContainer.EmitConstructors() [0x00000] in :0 at Mono.CSharp.TypeContainer.EmitType() [0x00000] in :0 at Mono.CSharp.RootContext.EmitCode() [0x00000] in :0 at Mono.CSharp.Driver.Compile() [0x00000] in :0 at Mono.CSharp.Driver.Main(System.String[] args) [0x00000] in :0

Here is the relevant code from LMathematica:

 public LMathematica() {
     if(Application.platform == RuntimePlatform.OSXEditor ||
             Application.platform == RuntimePlatform.OSXPlayer) {
         _kl = MathLinkFactory.CreateKernelLink("-linkmode launch -linkname '\"/Applications/Mathematica.app/Contents/MacOS/MathKernel\" -mathlink'");
         } else if(Application.platform == RuntimePlatform.WindowsEditor ||
             Application.platform == RuntimePlatform.WindowsPlayer) {
         _kl = MathLinkFactory.CreateKernelLink();
         } else {
             throw new Exception("We are not supposed to use local mathematica, or it is not supported on this platform");
         }
     // discard the initilal response kernel will send when launched
     _kl.WaitAndDiscardAnswer();
 }

How do I solve this...I'm pretty stuck. I looked around but the solutions are for Windows (like where they just grab the DLL from the program they're integrating. I checked the path and it's correct, so it must be calling System.Drawing within the MathLinkFactory stuff (http://reference.wolfram.com/mathematica/NETLink/ref/net/Wolfram.NETLink.html). No idea how I'd correct it if that is the problem though.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
7
Best Answer

Answer by Mizuho · Mar 31, 2013 at 02:19 AM

I managed to pass this by grabbing System.Drawing.dll from Unity.app/Contents/Frameworks/Mono/lib/mono/2.0 and putting that into my Assets. It was hard as Hell to find that thing...

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image $$anonymous$$ · May 07, 2014 at 04:51 PM 1
Share

How did you do that? I get an error: DllNotFoundException: gdiplus.dll System.Drawing.GDIPlus..cctor (). Do you work on Windows?

avatar image VReel $$anonymous$$ · Mar 23, 2017 at 07:04 PM 0
Share

Hi @$$anonymous$$, did you ever manage to fix the "gdiplus" problem?

avatar image imilanspinka · Sep 05, 2015 at 12:20 PM 0
Share

Thanks, worked for me :) :)

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

12 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

function on collision enter not working. 1 Answer

InvalidProgramException: Invalid IL code with Mono.Cairo on MacOS 0 Answers

How to Setup Openssl & Facebook SDK With Android key HASH on mac OS 10.11.6 1 Answer

Unity creates corrupt .psd duplicates when developing across Windows / macOS with Perforce 0 Answers

SkinnedMeshRenderer jitter on rotation Mac 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges