Placeholder-Software / Dissonance

Unity Voice Chat Asset
71 stars 5 forks source link

List of errors when building windows 10 store #43

Closed MatrixNAN closed 7 years ago

MatrixNAN commented 7 years ago

image

Context

Please fix the list of errors in the image above. These were generated when trying to export to Windows 10 Store build.

Expected Behavior

To not get errors when building for Windows 10 Store

Actual Behavior

got errors

Workaround

None

Fix

None

Steps to Reproduce

image Use the configuration in the build to reproduce the same problem.
Note you will need to install Visual Studio 2015 and https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk

Your Environment

Windows 10, i5 Intel, Nvidia 940 MX, 8 GB Ram, 1 tb hard drive.

martindevans commented 7 years ago

You seem to be using an old version of Dissonance. There's a few things in the log which shouldn't happen on the latest version:

Could you double check on the store for an update. If it's not showing up for you for some reason email me your order number and I'll send you the latest :)

I've just noticed an unfortunate error I made in the last update. I forgot to update the changelog file included in the package so you can't rely on that for a version - check the CurrentDissonanceVersion constant in the file Dissonance/Assets/Plugins/Dissonance/Editor/Welcome/WelcomeLauncher.cs instead. The latest version is 2.0.0.

MatrixNAN commented 7 years ago

image

Your correct I did not have the latest version. I imported the project in what I thought was less than a month it seems you have been putting out regular updates. Wow that's impressive. Still one error though. I deleted the old version folder and deleted it from the plugin folder then reimported. Then I got the error up above.

Same configuration as before.

Cheers, Nathaniel Nesler

martindevans commented 7 years ago

Well that's certainly strange - System.Threading should not contain a Task type! A few questions to clarify things:

MatrixNAN commented 7 years ago

Hey Martin,

Ok this one does not make sense to me. I looked at your code and your code looks correct however I am getting that error. Here is your code in question.

if NETFX_CORE

using System.Threading.Tasks;

endif

if NETFX_CORE

internal class DThread
    : IThread
{
    private readonly System.Threading.Tasks.Task _task;

Note line 22 is
private readonly System.Threading.Tasks.Task _task;

The error is Assets\Plugins\Dissonance\Core\Threading\DThread.cs(22,49): error CS0433: The type 'Task' exists in both 'System.Threading.Tasks, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System.Threading, Version=1.0.2856.102, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

What on earth is going on? How is that an error? You clearly defined which library it is coming from by giving the full namespace path so I do not see how on earth it can not resolve which namespace path Task is coming from. Do you see something I am missing?

Cheers, Nathaniel Nesler

MatrixNAN commented 7 years ago

Oh I think I know what the problem is in the code.

#else
    internal class DThread
        : IThread
    {
        private readonly Thread _thread;

        public DThread(Action action)
        {
            _thread = new Thread(new ThreadStart(action));
        }

        public void Start()
        {
            _thread.Start();
        }

        public void Join()
        {
            _thread.Join();
        }
    }
#endif
}

Note that the following line

private readonly Thread _thread;

is not defined for its namespace and it needs to be. I think since there is an else the if part above is not being considered by the compiler and so the line 22 to the compiler is not the line 22 in the code file because it is probably a pre-processor declaration for this if and else therefore when the compiler is evaluating the code the section of the if or else does not exist because it is not included in the code that went to the compiler.

Is that line of code suppose to read as:

private readonly System.Threading.Thread _thread;

?

Also line

public DThread(Action action)
{
    _thread = new System.Threading.Thread(new ThreadStart(action));
}

has to be changed also to include the namespace.

Cheers, Nathaniel Nesler

martindevans commented 7 years ago

Well this is very weird. I'm not at my development machine at the moment so I can't try this myself: I suggest simply removing all using statements from the top of the file and fully qualifying everything. If that works could you send me your fixed file by email (martin@placeholder-software.co.uk) and I'll make sure to include it in the next version :)

By the way which platform are you building for? Obviously UWP but are you trying to target Hololens (or planning to). I'm looking for people to test hololens support (in theory it should work right now, but I don't have the hardware to test it on).

MatrixNAN commented 7 years ago

image

I am using the mono develop that comes with Unity3d.
I have it set to .Net in the program application in the scripting backend.

Mono Develop Target Framework Mono / .Net 3.5

I just changed it to Mono / .Net 4.5 instead.

No difference same errors.

Have you included any other dependencies which may interfere (e.g. if you've manually loaded up a copy of System.Threading.Tasks).

I have no idea the project is several million lines of code including several 3rd party assets. The code I wrote does not do that but a 3rd party asset might for all I know.

Does fully qualifying Task as System.Threading.Tasks.Task fix all your build problems? No your code already had that which I demonstrated up above and that did not fix the problem.

The code file in question in its entirety:

using System.Threading;
//using System.Threading.Tasks;

#if NETFX_CORE
using System.Threading.Tasks;
#endif

namespace Dissonance.Threading
{
    internal interface IThread
    {
        void Start();

        void Join();
    }

#if NETFX_CORE
    internal class DThread
        : IThread
    {
        private readonly System.Threading.Tasks.Task _task;

        private readonly ManualResetEvent _finishedEvent = new ManualResetEvent(false);

        public DThread(Action action)
        {
            _task = new System.Threading.Tasks.Task(action, System.Threading.Tasks.TaskCreationOptions.LongRunning);
            _task.ContinueWith(_ => {
                _finishedEvent.Set();
            });
        }

        public void Start()
        {
            _task.Start();
        }

        public void Join()
        {
            _finishedEvent.WaitOne();
        }
    }
#else
    internal class DThread
        : IThread
    {
        private readonly System.Threading.Thread _thread;

        public DThread(Action action)
        {
            _thread = new System.Threading.Thread(new System.Threading.ThreadStart(action));
        }

        public void Start()
        {
            _thread.Start();
        }

        public void Join()
        {
            _thread.Join();
        }
    }
#endif
}

Cheers, Nathaniel Nesler

MatrixNAN commented 7 years ago

Note I fully qualified the names of your Thread just to be safe but it did not fix anything.

martindevans commented 7 years ago

I've just spent a while trying to replicate this. In editor I get no bugs (tested with 5.4, 5.5 & 5.6) when configured for UWP. Unfortunately I can't actually run a UWP build (I get an unrelated error about the windows SDK).

The only thing I can think of is one of your other plugins has imported the TPL for dotnet3.5 which is conflicting with the TPL included in the UWP runtime. Could you search in your project for:

I've asked a question on Stackoverflow to see if anyone else has any good ideas.

MatrixNAN commented 7 years ago

Ok yeah a 3rd party asset NAT Traversal makes use of it and for a 3.5

image

martindevans commented 7 years ago

Aha, that's definitely the issue then. You should probably exclude that file on WSAPlayer (the checkbox to do so is shown in the inspector in your screenshot). Hopefully the NAT Traversal asset will fall back to using the Task type provided by the runtime.

martindevans commented 7 years ago

Since this turned out not to be a problem with Dissonance I'll close this issue now. Feel free to continue posting here if you still need help :)

If you're happy with how this issue was handled please consider rating/reviewing us on the asset store.

MatrixNAN commented 7 years ago

Yeah it did not work it caused many more errors plus we still have that same error. I am going to look at removing that asset but I did not really want to do so because it works around networking problems to allow for connections to locally hosted servers etc without having to do cloud based servers. So it is a really asset but the voice chat is more important and I was hoping to use that asset with this voice chat asset among others.

martindevans commented 7 years ago

Is the 3rd party NAT traversal asset distributed as source or is it a precompiled DLL? If it's precompiled I guess you'd get runtime errors because it's looking for the Task type in a certain assembly which no longer exists. As far as I know there's no way to fix this in Unity, it might be possible with binding redirection but I'm not sure if it's possible to use that in Unity. Your only real hope in this case is to contact the asset creator and ask him to make a fully WSA compatible version of the asset.

If it's distributed as source I would have expected it to work unless the Task types in the two assemblies are subtly different - in which case I think your only option would be to fix the build errors. I can offer some help if this is the case.

MatrixNAN commented 7 years ago

Yeah it is a DLL precompiled and to top it off 2 other assets also use it such as Best HTTP which is absolutely essential to the project and EZSMTPMailer which is kind of important. The Nat Traversal was like icing on the cake but these other two are an absolute must. I might have to pull this voice chat asset from the project instead.

martindevans commented 7 years ago

You could try compiling Dissonance into a DLL - then it will be bound against the task type it wants (in the same way those other DLLs are) and it won't be a problem.