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
3
Question by Woutor · Feb 03, 2011 at 04:42 PM · xmlexceptionmonolinq

Can not reference System.Xml.Linq

Hi, I'm trying to use the System.Xml.Linq namespace to do some xml generation/parsing. Is there any way to get this to work?

I get these weird messages in Unity when I try to use XElement. The following code gives error messages:

var doc = new XDocument(new XElement("root"));

This code works:

var doc = new XDocument();

The error message I get is:

Internal compiler error. See the console log for more information. output was:
Unhandled Exception: Mono.CSharp.InternalErrorException: Assets/Scripts/Others/StartXmlSerializer.cs(12,14): StartXmlSerializer ---> Mono.CSharp.InternalErrorException: Assets/Scripts/Others/StartXmlSerializer.cs(32,21): StartXmlSerializer.Root ---> System.TypeLoadException: Could not load type 'System.ComponentModel.TypeDescriptionProviderAttribute' from assembly 'System.Xml.Linq'.
  at (wrapper managed-to-native) System.MonoCustomAttrs:GetCustomAttributesInternal (System.Reflection.ICustomAttributeProvider,System.Type,bool)
  at System.MonoCustomAttrs.GetCustomAttributesBase (ICustomAttributeProvider obj, System.Type attributeType) [0x00000] in 
  
   :0 
  at System.MonoCustomAttrs.GetCustomAttributes (ICustomAttributeProvider obj, System.Type attributeType, Boolean inherit) [0x00000] in 
   
    :0 
  at System.MonoType.GetCustomAttributes (System.Type attributeType, Boolean inherit) [0x00000] in 
    
     :0 
  at Mono.CSharp.AttributeTester.GetObsoleteAttribute (System.Type type) [0x00000] in 
     
      :0 
  at Mono.CSharp.Expression.ResolveAsTypeTerminal (IMemberContext ec, Boolean silent) [0x00000] in 
      
       :0 
  at Mono.CSharp.MemberBase.ResolveMemberType () [0x00000] in 
       
        :0 
  at Mono.CSharp.MemberBase.Define () [0x00000] in 
        
         :0 
  at Mono.CSharp.InterfaceMemberBase.Define () [0x00000] in 
         
          :0 
  at Mono.CSharp.Property.Define () [0x00000] in 
          
           :0 
  at Mono.CSharp.TypeContainer+MemberCoreArrayList.DefineContainerMembers () [0x00000] in 
           
            :0 
  --- End of inner exception stack trace ---
  at Mono.CSharp.TypeContainer+MemberCoreArrayList.DefineContainerMembers () [0x00000] in 
            
             :0 
  at Mono.CSharp.TypeContainer.DefineContainerMembers (Mono.CSharp.MemberCoreArrayList mcal) [0x00000] in 
             
              :0 
  at Mono.CSharp.Class.DefineContainerMembers (Mono.CSharp.MemberCoreArrayList list) [0x00000] in 
              
               :0 
  at Mono.CSharp.TypeContainer.DoDefineMembers () [0x00000] in 
               
                :0 
  at Mono.CSharp.Class.DoDefineMembers () [0x00000] in 
                
                 :0 
  at Mono.CSharp.TypeContainer.Define () [0x00000] in 
                 
                  :0 
  at Mono.CSharp.ClassOrStruct.Define () [0x00000] in 
                  
                   :0 
  at Mono.CSharp.Class.Define () [0x00000] in 
                   
                    :0 
  at Mono.CSharp.RootContext.PopulateTypes () [0x00000] in 
                    
                     :0 
  --- End of inner exception stack trace ---
  at Mono.CSharp.RootContext.PopulateTypes () [0x00000] in 
                     
                      :0 
  at Mono.CSharp.Driver.Compile () [0x00000] in 
                      
                       :0 
  at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in 
                       
                        :0 

                       
                      
                     
                    
                   
                  
                 
                
               
              
             
            
           
          
         
        
       
      
     
    
   
  

Comment
Add comment · Show 2
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 Vinpasso · Feb 03, 2011 at 09:28 PM 1
Share

Im not an expert at C Sharp, however it would help contributers a lot if you had some source code in your question

avatar image Woutor · Feb 04, 2011 at 08:44 AM 0
Share

good suggestion

3 Replies

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

Answer by Woutor · May 26, 2011 at 08:20 AM

from: http://answers.unity3d.com/questions/12884/does-a-plugin-work-independent-of-mono-framework.html

A .Net DLL isn't the same as a normal native code library. Your .Net DLL is a big pile of .Net opcodes and is expecting certain libraries to be available in your GAC (Global Assembly Cache).

Long answer long... no, the DLL will not work if it requires things that are available in .Net but not in Unity's version of Mono. If you really wanna try your hacking hand at things, you can copy your referenced .Net assemblies into the Mono.framework that's in your Unity install.

I guess it's not implemented in the version of Mono used by Unity and thus not available. A suggestion I read elsewhere was to use a C++ plugin that calls into a .Net assembly. This will allow the .Net assembly to use the Microsoft GAC instead of the Mono GAC.

Comment
Add comment · 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
1

Answer by Jozua · Feb 09, 2011 at 05:17 PM

I had to work around this error by removing all use of XElement. Basicly I stopped using System.Xml.Linq and recoded my serializer to make use of System.Xml exclusively. Unfortunately this is just a poor work around rather than a proper fix.

Comment
Add comment · 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
0

Answer by caqde · Apr 07, 2011 at 08:15 PM

Based on the code snippets I see either you are using C# and using its var command (which would work for certain things, but it shouldn't be used here) or you are using another language all together.

Anyways if this is indeed C# change your var to XDocument. var should only be used when you don't know for sure what type of variable is going to be sent to a function or class. If you are using var throughout your code you are slowing down your code and increasing the time it takes to compile your code along with bringing possible unnecessary bugs to your game.

If what I said is indeed what you are doing I would recommend reading up on C# and learning proper syntax for C#. All of your variables should either use int, float, double, bool, char, string, enum, or the name of a class. var should only be used when absolutely necessary.

I hope this helps with your problem.

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 Woutor · Apr 08, 2011 at 06:11 AM 1
Share

No, var is implicitly typed by the compiler: http://msdn.microsoft.com/en-us/library/bb383973.aspx Also remarks like these should be added as a comment rather as an answer as it is off topic.

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

1 Person is following this question.

avatar image

Related Questions

How can I find xmlconfiguration files that I import from Web? 0 Answers

xml : FormatException: Input string was not in the correct format 1 Answer

The requested feature is not implemented 0 Answers

LINQ, XML, putting XML nodes into an array 2 Answers

XmlWriter.Create exception, "Could not find the file..." on Android 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