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
0
Question by pumpkinszwan · Jun 21, 2014 at 01:27 AM · c#plugindllwindows storemetro

Win Store plugin causing internal compiler error

I have built a simple Windows Store plugin with a single method. It worked, and the functionality worked correctly in my game (I could build and deploy with no issues). However, when I came back to work on the game I was getting errors that seem to be caused by my plugin.

Now I can't even play the game inside Unity without removing the 'fake' DLL, and I can't build for Windows Store without having the fake DLL there...

Here is the error message: Internal compiler error. See the console log for more information. output was: Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.

   at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
 
   at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0 
 
   at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in <filename unknown>:0 
 
   at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in <filename unknown>:0 
 
   at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in <filename unknown>:0 
 
   at Mono.CSharp.Driver.LoadReferences () [0x00000] in <filename unknown>:0 
 
   at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0 
 
   at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0 


If I delete the fake DLL the error disappears (and I can run the game in the editor).

  • My DLLs are correctly named and share the same namespaces, etc

  • Both game and plugin target Windows 8.1

  • Fake DLL is in the plugins folder, real one is in the Plugins/Metro folder

  • Plugin projects target .net 3.5

  • I've used #if NETFX_CORE to wrap code in my plugin and #if UNITY_METRO within Unity scripts

  • FWIW I have a WP8 plugin that is similar and works fine

Here is a repro of my DLL files (I've included the full VS solution in case someone is kind enough to check for dumb errors. The built DLLs are in the respective bin/release folders of the two projects. The entire source code is there (it's just a single method that launches an email).

DLLs that cause internal compiler error

Any ideas what I've done wrong? The weird thing is that it worked fine, then suddenly gives this showstopper error.

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
1

Answer by CanisLupus · Jun 22, 2014 at 04:20 PM

Are you building your fake dll from a Visual Studio project for a "Windows Store app"? If that is so, I believe VS will reference libraries that don't exist in Mono, and #if NETFX_CORE won't save you from this. Even if you try creating a dll from an empty file with no code it still gives errors in Unity.

Seeing how the fake dll is not to be used in Windows Store Apps, it should be outside the Plugins/Metro folder (as you already have) and I think it should be created as a normal desktop library in Visual Studio (I don't have the VS version for this, however).

Do you really need the fake dll? I'm guessing you want to use it to call empty methods in non-Windows-Store apps, hence the "fake" word. However, you said "I can't build for Windows Store without having the fake DLL there...". Maybe that is because you use #if UNITY_METRO in your scripts, and should instead use #if NETFX_CORE, because UNITY_METRO is active in the Editor when you have Windows Store apps as a target, causing Unity to try to use your plugin and failing.

In places where you need to reference the "true" dll in your scripts, you should use #if NETFX_CORE, and a fake dll shouldn't be necessary.

Comment
Add comment · Show 1 · 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 pumpkinszwan · Jun 22, 2014 at 11:58 PM 0
Share

Thanks for the help. I am under the impression I must have the 'fake' DLL in my Unity project in order for it to work. I will try out your suggestions: use #if NETFX_CORE where I am using #if UNITY_$$anonymous$$ETRO, and then try building my DLL as a desktop project ins$$anonymous$$d of a Windows Store project.

thanks

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

22 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Distribute terrain in zones 3 Answers

Breakpoints in MonoBehaviour code called from SmartFoxServer2X.dll cause Editor debugging hangs. 0 Answers

Use a Different DLL When Building Application? 1 Answer

Connecting to a Qpid Broker 0 Answers

Dll distribution of Conditionally Compiled project 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