GlitchEnzo / NuGetForUnity

A NuGet Package Manager for Unity
MIT License
3.18k stars 313 forks source link

TypeLoadException: Could not resolve type with token 01000037 #87

Closed UkonnRa closed 3 years ago

UkonnRa commented 7 years ago

Unity version: 2017.2.0b11

When searching for the Nuget package, the error message after is shown.

I wonder why I cannot use the Nuget package installed by the visual studio?

TypeLoadException: Could not resolve type with token 01000037 (from typeref, class/assembly System.ServiceModel.Syndication.SyndicationFeed, System.ServiceModel.Web, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
NugetForUnity.NugetPackageSource.Search (System.String searchTerm, System.Boolean includeAllVersions, System.Boolean includePrerelease, System.Int32 numberToGet, System.Int32 numberToSkip) (at <b8b5bb12b8434a5285935caa38a54646>:0)
NugetForUnity.NugetHelper.Search (System.String searchTerm, System.Boolean includeAllVersions, System.Boolean includePrerelease, System.Int32 numberToGet, System.Int32 numberToSkip) (at <b8b5bb12b8434a5285935caa38a54646>:0)
NugetForUnity.NugetWindow.UpdateOnlinePackages () (at <b8b5bb12b8434a5285935caa38a54646>:0)
NugetForUnity.NugetWindow.DrawOnlineHeader () (at <b8b5bb12b8434a5285935caa38a54646>:0)
NugetForUnity.NugetWindow.DrawOnline () (at <b8b5bb12b8434a5285935caa38a54646>:0)
NugetForUnity.NugetWindow.OnGUI () (at <b8b5bb12b8434a5285935caa38a54646>:0)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:305)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:313)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/referencesource/mscorlib/system/reflection/methodbase.cs:229)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at /Users/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:285)
UnityEditor.HostView.Invoke (System.String methodName) (at /Users/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:278)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition) (at /Users/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:251)
UnityEditor.DockArea.OldOnGUI () (at /Users/builduser/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:383)
UnityEngine.Experimental.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt) (at /Users/builduser/buildslave/unity/build/Runtime/UIElements/Managed/IMGUIContainer.cs:143)
UnityEngine.Experimental.UIElements.IMGUIContainer.HandleEvent (UnityEngine.Experimental.UIElements.EventBase evt) (at /Users/builduser/buildslave/unity/build/Runtime/UIElements/Managed/IMGUIContainer.cs:213)
UnityEngine.Experimental.UIElements.EventDispatcher.DispatchEvent (UnityEngine.Experimental.UIElements.EventBase evt, UnityEngine.Experimental.UIElements.BaseVisualElementPanel panel) (at /Users/builduser/buildslave/unity/build/Runtime/UIElements/Managed/EventDispatcher.cs:182)
UnityEngine.Experimental.UIElements.UIElementsUtility.DoDispatch (UnityEngine.Experimental.UIElements.BaseVisualElementPanel panel) (at /Users/builduser/buildslave/unity/build/Runtime/UIElements/Managed/UIElementsUtility.cs:207)
UnityEngine.Experimental.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at /Users/builduser/buildslave/unity/build/Runtime/UIElements/Managed/UIElementsUtility.cs:72)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at /Users/builduser/buildslave/unity/build/Runtime/IMGUI/Managed/GUIUtility.cs:175)
GlitchEnzo commented 7 years ago

It looks like you're using the old 0.0.10 binary package that still has a dependency on System.ServiceModel.Web.dll. The latest 0.0.11 no longer has this dependency. I haven't yet made a 0.0.11 release, but I can make that a higher priority item for me to address.

UkonnRa commented 7 years ago

Well, where could I find the 0.0.11 version? What's more, I want to ask the difference between this plugin and the origin Nuget tool. For I cannot use some packages downloaded from the Nuget tool(yes, I am talking about SocketIoClientDotNet)

GlitchEnzo commented 7 years ago

I hadn't yet made the 0.0.11 release when I first commented, but it is now available in the releases: https://github.com/GlitchEnzo/NuGetForUnity/releases

As for using the NuGet client built into Visual Studio, that doesn't work because Unity automatically regenerates the .sln and .csproj files whenever any code in the game changes, which wipes away all NuGet packages you've installed. This tool (NuGetForUnity) provides a NuGet client directly inside the Unity Editor that manages all of the NuGet package installation and restoration for you. All packages can be restored even without any .sln or .csproj files.

GlitchEnzo commented 7 years ago

Additionally, I was able to successfully install SocketIoClientDotNet version 0.9.13 using NuGetForUnity 0.0.11 in Unity 2017.1 on Windows 10.

UkonnRa commented 7 years ago

New question, maybe it is a Mac only problem...

System.Net.WebException: Error: SecureChannelFailure (Security) ---> System.DllNotFoundException: Security
  at (wrapper managed-to-native) Mono.AppleTls.AppleTlsContext:SSLCreateContext (intptr,Mono.AppleTls.SslProtocolSide,Mono.AppleTls.SslConnectionType)
  at Mono.AppleTls.AppleTlsContext.InitializeConnection () [0x0000c] in <344dc4d3f1ad41809df78607b6121a41>:0 
  at Mono.AppleTls.AppleTlsContext.StartHandshake () [0x00015] in <344dc4d3f1ad41809df78607b6121a41>:0 
  at Mono.Net.Security.MobileAuthenticatedStream.ProcessHandshake (Mono.Net.Security.AsyncProtocolRequest asyncRequest, Mono.Net.Security.AsyncOperationStatus status) [0x00004] in <344dc4d3f1ad41809df78607b6121a41>:0 
  at Mono.Net.Security.AsyncProtocolRequest.ProcessOperation (Mono.Net.Security.AsyncOperationStatus status) [0x0006b] in <344dc4d3f1ad41809df78607b6121a41>:0 
  at Mono.Net.Security.AsyncProtocolRequest.ProcessOperation () [0x0000d] in <344dc4d3f1ad41809df78607b6121a41>:0 
  at Mono.Net.Security.AsyncProtocolRequest.StartOperation () [0x0003c] in <344dc4d3f1ad41809df78607b6121a41>:0 
  at Mono.Net.Security.AsyncProtocolRequest.StartOperation (Mono.Net.Security.AsyncOperation operation) [0x00024] in <344dc4d3f1ad41809df78607b6121a41>:0 
  at Mono.Net.Security.MobileAuthenticatedStream.ProcessAuthentication (System.Net.LazyAsyncResult lazyResult) [0x00057] in <344dc4d3f1ad41809df78607b6121a41>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builduser/buildslave/mono/build/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:151 
  at Mono.Net.Security.MobileAuthenticatedStream.ProcessAuthentication (System.Net.LazyAsyncResult lazyResult) [0x00078] in <344dc4d3f1ad41809df78607b6121a41>:0 
  at Mono.Net.Security.MobileAuthenticatedStream.AuthenticateAsClient (System.String targetHost, System.Security.Cryptography.X509Certificates.X509CertificateCollection clientCertificates, System.Security.Authentication.SslProtocols enabledSslProtocols, System.Boolean checkCertificateRevocation) [0x0000c] in <344dc4d3f1ad41809df78607b6121a41>:0 
  at Mono.Net.Security.Private.MonoSslStreamWrapper.AuthenticateAsClient (System.String targetHost, System.Security.Cryptography.X509Certificates.X509CertificateCollection clientCertificates, System.Security.Authentication.SslProtocols enabledSslProtocols, System.Boolean checkCertificateRevocation) [0x00006] in <344dc4d3f1ad41809df78607b6121a41>:0 
  at Mono.Net.Security.MonoTlsStream.CreateStream (System.Byte[] buffer) [0x0007b] in <344dc4d3f1ad41809df78607b6121a41>:0 
  at System.Net.WebConnection.CreateStream (System.Net.HttpWebRequest request) [0x00073] in <344dc4d3f1ad41809df78607b6121a41>:0 
   --- End of inner exception stack trace ---
  at System.Net.HttpWebRequest.EndGetResponse (System.IAsyncResult asyncResult) [0x00058] in <344dc4d3f1ad41809df78607b6121a41>:0 
  at System.Net.HttpWebRequest.GetResponse () [0x0000e] in <344dc4d3f1ad41809df78607b6121a41>:0 
  at NugetForUnity.NugetPackageSource.GetPackagesFromUrl (System.String url) [0x00089] in <4e881643001441888fae657e4de10c62>:0 
UnityEngine.Debug:LogErrorFormat(String, Object[])
NugetForUnity.NugetPackageSource:GetPackagesFromUrl(String)
NugetForUnity.NugetPackageSource:Search(String, Boolean, Boolean, Int32, Int32)
NugetForUnity.NugetHelper:Search(String, Boolean, Boolean, Int32, Int32)
NugetForUnity.NugetWindow:UpdateOnlinePackages()
NugetForUnity.NugetWindow:DrawOnlineHeader()
NugetForUnity.NugetWindow:DrawOnline()
NugetForUnity.NugetWindow:OnGUI()
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
GlitchEnzo commented 7 years ago

Unfortunately, I've never tested NuGetForUnity on a Mac.

Searching on Google showed me that at least one other person is having a similar problem with using .NET 4.6 in Unity 2017 on Mac: https://issuetracker.unity3d.com/issues/mac-dot-net-4-dot-6-system-dot-net-dot-webexception-error-in-net-4-dot-6

I'll continue to investigate, but without a Mac progress will be slow.

weijia-yu commented 6 years ago

@GlitchEnzo I am also having System.DllNotFoundException: Security only in mac and iOS, is that because I need to install openSSL? @CasterKKK Did you find any solution to this?

jwittner commented 3 years ago

Closing as very old and not being reported by others.