New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is defined multiple times #1

Open
farzadi opened this Issue Jul 12, 2017 · 51 comments

Comments

Projects
None yet
@farzadi

farzadi commented Jul 12, 2017

I have errors in some of my packages.
Is this error under test and resolving? if yes, please let me know how long it takes to be resolved and help me solve the problem temporarily.
The packages that had conflict in my project were NGUI and UnityMainThreadDispatcher.

The type 'Action' exists in both 'SocketIoClientDotNet, Version =1.0.0.0 , Culture=neutral , PublicKeyToken=null' and System.Core, Version =3.5.0, Culture=neutral , PublicKeyToken = b77a5c561934e089'

and

The type'Func' exists in both 'System.Core', Version=3.5.0.0 , Culture=neutral,PublicKeyToken = b77a5c56193e089 and 'WebSocket4Net, Version =0.14.1.0 ,Culture=neutral ,PublicKeyToken = ed4e154b696bf72a'

@vnedilko

This comment has been minimized.

vnedilko commented Jul 12, 2017

Same problem. Hope soon will be fixed.

@floatinghotpot

This comment has been minimized.

Owner

floatinghotpot commented Jul 12, 2017

It will be helpful if you can provide the version number of:

  • Unity
  • Mono
  • .NET
@vnedilko

This comment has been minimized.

vnedilko commented Jul 12, 2017

Last version of unity 2017.1f3, released 11 July 2017

@farzadi

This comment has been minimized.

farzadi commented Jul 13, 2017

Unity 5.5.1f1
.NET v4.5.x v4.5.x v4.6.x

@floatinghotpot

This comment has been minimized.

Owner

floatinghotpot commented Jul 13, 2017

As I know, you can use .NET v4.5 on Windows/XBOX platform, but to build runtime for cross platform like iOS or Android, you need select Mono and .NET 2.0.

See:
http://answers.unity3d.com/questions/1305565/as-of-12017-what-is-the-highest-version-of-net-tha.html

@vnedilko

This comment has been minimized.

vnedilko commented Jul 13, 2017

This error present in editor and break all work.
With lasterst release of unity you cant use this pluging becouse of error.
Looks like you have same named classes.

@vnedilko

This comment has been minimized.

vnedilko commented Jul 13, 2017

Settings
untitled-1

Errors

error CS0433: The imported type `System.Action' is defined multiple times

error CS0433: The imported type `System.Func' is defined multiple times

error CS0433: The imported type `System.Func<T,TResult>' is defined multiple times

@floatinghotpot

This comment has been minimized.

Owner

floatinghotpot commented Jul 13, 2017

Weird, I still did not figure out what happens in your situation.

It works quite well when I test the demo project with Unity 5.4.4 in my office and Unity 5.6.1 at home.

Or, you may try building the library from source code here (using branch net20):
https://github.com/floatinghotpot/SocketIoClientDotNet/tree/net20

@floatinghotpot

This comment has been minimized.

Owner

floatinghotpot commented Jul 13, 2017

Hi guys, I just downloaded and install Unity 2017.1 (on my iMac), start the test-server/index.js, then open the Demo/Hello.unity in Unity, configure the URL, then run the demo in Unity, it works just fine. See the attached screenshot.

socketio-demo

@jake

This comment has been minimized.

jake commented Jul 13, 2017

Also having this issue, with completely unrelated libraries.

Assets/ThirdParty/SteamVR/InteractionSystem/Core/Scripts/Util.cs(411,69): error CS0433: The imported type `System.Action' is defined multiple times

Sounds like maybe something in one of these DLLs is writing something to System.Action, which is causing unexpected other third party libraries using the same name?

@farzadi

This comment has been minimized.

farzadi commented Jul 14, 2017

Yes if you just use this package its not have a problem, errors came from when you add other packages to your project

@vnedilko

This comment has been minimized.

vnedilko commented Jul 14, 2017

Sample code for receive this issues

using System;
using UnityEngine;

public class Test:MonoBehaviour
{
    public Action callback;
    public Func<int> callback2;
    public Func<int, bool> callback3;
}
@gershhub

This comment has been minimized.

gershhub commented Jul 19, 2017

I am seeing the same System.Action collision issue with a BLE plugin.

@Oakshiro

This comment has been minimized.

Oakshiro commented Jul 25, 2017

Same problem here, System.Func' is defined multiple times all around

@tbhyn

This comment has been minimized.

tbhyn commented Aug 26, 2017

Encountering this problem with Vuforia. What can we do in such a case?

@floatinghotpot

This comment has been minimized.

Owner

floatinghotpot commented Sep 4, 2017

Here is the source code,
https://github.com/floatinghotpot/SocketIoClientDotNet/tree/net20

If anyone wanna contribute, try forking the code and help to fix it.

@marius-bughiu

This comment has been minimized.

marius-bughiu commented Sep 6, 2017

Looks like two different packages try to define the same type in the same namespace by either

  • having two different dependencies that define the same Namespace.Type
  • maybe referring to two different versions of the same dependency

My eyes are on System.Threading.Tasks.Unofficial. It seems to be defining some types for compatibility. If, for example, some other plugin would be using the TaskParallelLibrary - then I could see why these two plugins would probably not work together.

Unfortunately I won't have any time for this until next week.
If it's not solved by then I will have a look.

A sample project on Git to reproduce the issue would help a lot.

@alex-carlson

This comment has been minimized.

alex-carlson commented Sep 25, 2017

I'm getting an error in Unity that is probably related to this.

ArgumentException: An element with the same key already exists in the dictionary.

It looks like that's being triggered when I try to connect to the server after initially declaring socket = null;. The error doesn't happen if I just do socket = "http://localhost:3000"; for example.

I'm also running on latest Unity 2017.1.1f1

@Dr-Jerm

This comment has been minimized.

Dr-Jerm commented Oct 3, 2017

Just getting on the "I'm having problems too" train. Here's my output:

The type 'Func<T1, T2, TResult>' exists in both 'System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and 'WebSocket4Net, Version=0.14.1.0, Culture=neutral, PublicKeyToken=eb4e154b696bf72a'

As stated above, only seems to break in the presence of other packages. In my specific case it's https://github.com/neuecc/UniRx

@patricknelson

This comment has been minimized.

patricknelson commented Dec 25, 2017

Just researching this for now... but: @marius-bughiu - Did you ever get a chance to work on this a bit more?

@GkhanKINAY

This comment has been minimized.

Contributor

GkhanKINAY commented Jan 9, 2018

I am using UnityAction until the problem will be solved.
Here is the example usage,

using UnityEngine;
using UnityEngine.Events;

public class Test : MonoBehaviour 
{
	private void Start () 
	{
		DemoLog( () => 
		{
			Debug.Log("Second message"); 
		});
	}

	private void DemoLog(UnityAction callback)
	{
		Debug.Log("First message");
		callback();
	}
}

@floatinghotpot, can you fix this = #10 ?
Thanks.

@Vellames

This comment has been minimized.

Vellames commented Jan 18, 2018

Same problem here guys
@GkhanKINAY Thank you for your tip, this saved my day :)

@siordache94

This comment has been minimized.

siordache94 commented Jan 27, 2018

Hi ,
how is using UnityEngine.Events; supposed to fix the issue ? Currently at GGJ , conflicting with STEAMVR
will be waitin for you answer.
Thanks in advance!

@GkhanKINAY

This comment has been minimized.

Contributor

GkhanKINAY commented Jan 27, 2018

@siordache94 Hi, good luck in GGJ.
Use "UnityAction" instead of "Action"
Where is your problem?

@siordache94

This comment has been minimized.

siordache94 commented Jan 27, 2018

it's very deep , if you try to import this and https://www.assetstore.unity3d.com/en/#!/content/32647 this asset, there's conflict on action , i tried putting either unityaction in steamvr , tried wrappin system in sys (in case of conflicting namespace)
after changing all the references to system.action i get 40+ other errors.
IF (and thats a big if) there's a quick fix that you know about ( i have little to no experience ) , please do share...
thank you

@GkhanKINAY

This comment has been minimized.

Contributor

GkhanKINAY commented Jan 27, 2018

@siordache94 I change Util.cs and now working, i think.
Replace Assets/SteamVR/InteractionSystem/Core/Scripts/Util.cs

Util.cs.zip

@James-Quigley

This comment has been minimized.

James-Quigley commented Jan 28, 2018

I'm having the same issue. Unity 2017.3 and .NET 3.5. Replacing System.Action with UnityAction works sometimes, but not always, so it isn't really a valid fix for me. Does anybody have any thoughts as to what might be causing this? I'm new to Unity and C#, so unfortunately I'm pretty clueless

@patricknelson

This comment has been minimized.

patricknelson commented Feb 1, 2018

@GkhanKINAY If you think you've got a viable fix, could you submit a PR and reference this ticket?

@GkhanKINAY

This comment has been minimized.

Contributor

GkhanKINAY commented Feb 1, 2018

@patricknelson OK, i fixed the problem on the source code. (https://github.com/floatinghotpot/SocketIoClientDotNet/pull/1)

@floatinghotpot

This comment has been minimized.

Owner

floatinghotpot commented Feb 2, 2018

Thanks to @GkhanKINAY , the file has been merged.

@James-Quigley

This comment has been minimized.

James-Quigley commented Feb 5, 2018

I'm attempting to use this library alongside Google Poly Toolkit. I'm still running into the System.Action is defined multiple times, even with the new dlls from @GkhanKINAY. Did the issue actually get fixed, or is this potentially an issue with the Poly Toolkit?

@GkhanKINAY

This comment has been minimized.

Contributor

GkhanKINAY commented Feb 5, 2018

@James-Quigley hmm, i will test in 1-2 hour.

@GkhanKINAY

This comment has been minimized.

Contributor

GkhanKINAY commented Feb 5, 2018

@James-Quigley Hi again, sorry for delay. I tested and your problem is WebSocket4Net.dll, not SocketIoClientDotNet.dll. (And you need delete Newtonsoft.Json.dll because "Poly Toolkit" project is have one.)

Problem: https://github.com/kerryjiang/WebSocket4Net/blob/master/WebSocket4Net/Action.cs

@James-Quigley

This comment has been minimized.

James-Quigley commented Feb 6, 2018

@GkhanKINAY Thanks so much for your help. So the fix is to go into the source for WebSocket4Net and change the Action definition and all its references to something else e.g. CustomAction?

@GkhanKINAY

This comment has been minimized.

Contributor

GkhanKINAY commented Feb 6, 2018

@James-Quigley Yes, you are right. (I changed "ActionTrigger" instead of "Action" and build:SocketIoClientDotNet.dll)
Look my pull request: floatinghotpot/SocketIoClientDotNet#1

@Xortrox

This comment has been minimized.

Xortrox commented Feb 9, 2018

I have a similar issue where "System.Func" is defined multiple times

Replacing it with other things just causes more errors like ".Contains is not defined, are you missing a using reference" which then suggest System.Linq or Quobject.Collections.Immutable in some classes like "Unity3DRider.cs"

@siordache94

This comment has been minimized.

siordache94 commented Feb 10, 2018

Hi,
the multiple declaration is an issue also with the postprocessing stack and volumetric lighting
can you please wrap this module in a namespace, fixing all possible issues, please?

@not82

This comment has been minimized.

not82 commented Feb 18, 2018

Hi ,
Got the same issue here, with Zenject.

It seams WebSocket4Net got a mscorelib different of .NET 2.0 included in recent versions of Unity.. And Zenject is using it and don't know what reference he must use. ( same package , but 2 different sources )

:/

@timgoeij

This comment has been minimized.

timgoeij commented Feb 27, 2018

Hi

I have the issue where the System.Func<T, TResult> is defined multiple times with the websocket4net dll in combination with the mapbox api. I am using unity2017.2

@Andychan0704

This comment has been minimized.

Andychan0704 commented Mar 6, 2018

Hi,

Seems the fix only changed "Action fn" to "ActionTrigger fn". (source code in AckImpl.cs or elsewhere)

Believe, others such as

Action fn1;
Action<object, object> fn2;
Action<object, object, object> fn3;

also need to be changed as well.

As I encountered the issue (defined multiple times) for those calls (ie. System.Action, System.Action<T1,T2>, System.Action<T1,T2,T3> ... is defined multiple times)

Cheers

@ahmedsherpiny

This comment has been minimized.

ahmedsherpiny commented Mar 15, 2018

Hi,

I still have this problem when I uses Fingers - Touch Gestures from AssetStore.

I face it with System,Action<T1,T2,T3>() and System.Func()

Any hints or workarounds?

@Lesliehdezg

This comment has been minimized.

Lesliehdezg commented Apr 17, 2018

same error but with websocket4net.dll

the error with SocketIoClientDotNet works.

@IlyaVorozhbit

This comment has been minimized.

IlyaVorozhbit commented Apr 17, 2018

короче, просто нужно взять другой провайдер сокета для юнити и всё

@farukcan

This comment has been minimized.

farukcan commented Apr 18, 2018

same error with websocket4net.dll :

Assets/GMES/UTIL/ExpressionParser.cs(303,43): error CS0433: The imported type System.Func<T,TResult>' is defined multiple times Assets/GMES/FullSerializer/Source/fsConfig.cs(70,16): error CS0433: The imported type System.Func<T1,T2,TResult>' is defined multiple times

@Lesliehdezg

This comment has been minimized.

Lesliehdezg commented Apr 20, 2018

Wich new provider recommend?

@henrikljungberg5467

This comment has been minimized.

henrikljungberg5467 commented May 6, 2018

I wanted to use this with IBM Watson SDK (speech-to-text) and got "Is defined multiple times" problem. Also another time I was tryng to use it alongside the Embedded browser asset (https://assetstore.unity.com/packages/tools/gui/embedded-browser-55459) and that gave me loads of "Is defined multiple times" problems.

@det3d

This comment has been minimized.

det3d commented May 22, 2018

I'm having the same problem trying to use Socket.IO and Hololens in Unity.
Getting error CS0433 'System.Action<T1,T2>'
Also getting the error for 'System.Func'
Not really sure how to fix this. Tried downloading the Fix above for the SocketIoClientDotNet.dll file, but nothing really changed. Any help would be great!

@James-Quigley

This comment has been minimized.

James-Quigley commented May 22, 2018

@det3d I ended up using the BestHTTP Unity library to do Socket.IO stuff on the HoloLens. It worked great! It is paid, but honestly saved me so much headache that it is probably worth it.

@det3d

This comment has been minimized.

det3d commented May 24, 2018

@hypeofpipe

This comment has been minimized.

hypeofpipe commented Jun 22, 2018

It still doesn't work because it is a indus code!

@JCanovas

This comment has been minimized.

JCanovas commented Sep 14, 2018

same error with websocket4net.dll :
I am using it together with the oculus plugin "Oculus integration" and the error appears in System.Func...Any Solution? Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment