aws / aws-sdk-net

The official AWS SDK for .NET. For more information on the AWS SDK for .NET, see our web site:
http://aws.amazon.com/sdkfornet/
Apache License 2.0
2.06k stars 854 forks source link

[UNITY][ISSUE]Conflict between native System.IO.InvalidDataException & yours #1140

Closed liszto closed 3 years ago

liszto commented 5 years ago

In Unity when we import your package everything is fine but as soon as another script try to access to "System.IO.InvalidDataException" it will create a conflict and the compiler can't resolve. We are using :

This is the incriminated script :

/*
 * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 * 
 *  http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed
 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 * express or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */

using System;
using System.Runtime.Serialization;

namespace System.IO {
    [Serializable()] 
    public sealed class InvalidDataException  : SystemException
    {
        public InvalidDataException ()
            : base() {
        }

        public InvalidDataException (String message)
            : base(message) {
        }

        public InvalidDataException (String message, Exception innerException)
            : base(message, innerException) {
        }

        internal InvalidDataException (SerializationInfo info, StreamingContext context) : base(info, context) {
        }

    }
}

if you called just this script in Unity project, you will generate the issue :

using UnityEngine;

public class Test : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        throw new System.IO.InvalidDataException();
    }
}

Why are you keeping this, whereas it's implemented in System.IO C# library ?

You can just removed it no or use at least a custom namespace if you want to have your own InvalidDataException ? But when I see your implementation it seems to be just a complete empty nutshell that could just create issue.

Thanks.

liszto commented 5 years ago

Any news ?

novavision commented 5 years ago

got the same problem... have no clue why that been done this way

Handy-TN commented 5 years ago

I have downloaded the newest sdk for Unity and this issue still happen. Any solution for this?

liszto commented 5 years ago

@klaytaybai do you have any news on this ?

Handy-TN commented 5 years ago

[UPDATED 1] I have tried the method below and it doesn't work. I have been thinking if there is some kind of dll extractor so it can do something like unzip the dll into the original script. And after that I just need to remove the duplicate 'InvalidDataException.cs' Any other solutions? Thanks before.

[ORIGINAL POST] Well I found this in the archive: https://github.com/amazon-archives/aws-sdk-unity Haven't really tried it because the last update time is 3 years ago.

If there is any package or some link that I can download the raw format (.cs and others), not the .dll format, it would be much helpful since I can just delete the temporary 'InvalidDataException.cs' script anyway

phoenleo commented 5 years ago

@sstevenkang @normj Any news regarding this Issue? Currently AWS SDK is unusable in Unity 2018.

OrangePretzel commented 5 years ago

Has anyone found a workaround/update to this issue?

chaola commented 5 years ago

my workaround:

RobbyZ commented 5 years ago

Thanks, that worked for me (wasn't able to figure out how to set TargetFrameworkVersion, but haven't hit an error yet either)

martoko commented 4 years ago

This currently means that you CANNOT use the AWS SDK with Unity.

When is this being fixed?

gamedev2492 commented 4 years ago

I can't build AWSSDK.Unity.sln.. getting UnityEngine not found error. I have installed Unity on a standard location in Mac. Does this only work in Windows?

liszto commented 4 years ago

@gamedev2492 are you blaming me for an aws trouble? 🤔

Handy-TN commented 4 years ago

Is this still an issue? The last time I download the SDK, it has already been solved. Don't know if it happens again on the latest one. I haven't used it for a while.

ashishdhingra commented 3 years ago

Hi @liszto,

Good afternoon.

Please review comment from @Handy-TN. Kindly confirm if this is still an issue.

Thanks, Ashish

github-actions[bot] commented 3 years ago

This issue has not recieved a response in 2 weeks. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled.

AlonLivne commented 2 years ago

Hi, I hope I am not too late here. The solution is simple, although not trivial. I'll write the steps and below an explanation.

  1. Download the package through NuGet (website/rider/visual studio)
  2. If it's in nupkg format, edit the name and change the extention from .nupckg to .zip, if not, skip to 4.
  3. Extract the files via ZIP, go to the relevant folder (usually 2.0)
  4. Copy the DLL file
  5. Open your unity project on Assets folder, if it contains Plugins folder, open it. If not, create one and open it.
  6. Copy the DLL to the Plugins folder
  7. Test!

Explanation: This will work for any NuGet package, not just AWS. AWS used to have an SDK for Unity, which included missing file definitions. That SDK has been abandoned, and since Unity added the missing files and classes, there is a duplication which is hard to solve. More over, the SDK is not updating so it would be better to download the AWS SDK for .NET which includes all the functionality needed for Unity. In order for Unity to include the package, it's not enough to import it through the IDE, you need it in your plugins folder so it will be included in the prioject AND in the build. Good luck!