Skip to content
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

Compiler error when importing via UPM #38

Closed
JesseTG opened this issue Jan 21, 2021 · 9 comments
Closed

Compiler error when importing via UPM #38

JesseTG opened this issue Jan 21, 2021 · 9 comments

Comments

@JesseTG
Copy link

JesseTG commented Jan 21, 2021

When I import ZString with the following minimal manifest.json...

{
  "scopedRegistries": [
    {
      "name": "package.openupm.com",
      "url": "https://package.openupm.com",
      "scopes": [
        "com.cysharp.zstring"
      ]
    }
  ],
  "dependencies": {
    "com.cysharp.zstring": "2.3.1",
    "com.unity.2d.animation": "5.0.3",
    "com.unity.2d.pixel-perfect": "4.0.1",
    "com.unity.2d.psdimporter": "4.0.2",
    "com.unity.2d.sprite": "1.0.0",
    "com.unity.2d.spriteshape": "5.1.0",
    "com.unity.2d.tilemap": "1.0.0",
    "com.unity.collab-proxy": "1.3.9",
    "com.unity.ide.rider": "2.0.7",
    "com.unity.ide.visualstudio": "2.0.5",
    "com.unity.ide.vscode": "1.2.3",
    "com.unity.test-framework": "1.1.19",
    "com.unity.textmeshpro": "3.0.1",
    "com.unity.timeline": "1.4.4",
    "com.unity.ugui": "1.0.0",
    "com.unity.modules.ai": "1.0.0",
    "com.unity.modules.androidjni": "1.0.0",
    "com.unity.modules.animation": "1.0.0",
    "com.unity.modules.assetbundle": "1.0.0",
    "com.unity.modules.audio": "1.0.0",
    "com.unity.modules.cloth": "1.0.0",
    "com.unity.modules.director": "1.0.0",
    "com.unity.modules.imageconversion": "1.0.0",
    "com.unity.modules.imgui": "1.0.0",
    "com.unity.modules.jsonserialize": "1.0.0",
    "com.unity.modules.particlesystem": "1.0.0",
    "com.unity.modules.physics": "1.0.0",
    "com.unity.modules.physics2d": "1.0.0",
    "com.unity.modules.screencapture": "1.0.0",
    "com.unity.modules.terrain": "1.0.0",
    "com.unity.modules.terrainphysics": "1.0.0",
    "com.unity.modules.tilemap": "1.0.0",
    "com.unity.modules.ui": "1.0.0",
    "com.unity.modules.uielements": "1.0.0",
    "com.unity.modules.umbra": "1.0.0",
    "com.unity.modules.unityanalytics": "1.0.0",
    "com.unity.modules.unitywebrequest": "1.0.0",
    "com.unity.modules.unitywebrequestassetbundle": "1.0.0",
    "com.unity.modules.unitywebrequestaudio": "1.0.0",
    "com.unity.modules.unitywebrequesttexture": "1.0.0",
    "com.unity.modules.unitywebrequestwww": "1.0.0",
    "com.unity.modules.vehicles": "1.0.0",
    "com.unity.modules.video": "1.0.0",
    "com.unity.modules.vr": "1.0.0",
    "com.unity.modules.wind": "1.0.0",
    "com.unity.modules.xr": "1.0.0"
  }
}

...I get this set of compiler errors:

Library\PackageCache\com.cysharp.zstring@2.3.1\EnumUtil.cs(37,52): error CS0246: The type or namespace name 'Span<>' could not be found (are you missing a using directive or an assembly reference?)

Library\PackageCache\com.cysharp.zstring@2.3.1\EnumUtil.cs(37,86): error CS0246: The type or namespace name 'ReadOnlySpan<>' could not be found (are you missing a using directive or an assembly reference?)

Library\PackageCache\com.cysharp.zstring@2.3.1\EnumUtil.cs(48,51): error CS0246: The type or namespace name 'Span<>' could not be found (are you missing a using directive or an assembly reference?)

Library\PackageCache\com.cysharp.zstring@2.3.1\EnumUtil.cs(48,85): error CS0246: The type or namespace name 'StandardFormat' could not be found (are you missing a using directive or an assembly reference?)

Library\PackageCache\com.cysharp.zstring@2.3.1\Number\BitOperations.cs(23,24): error CS0246: The type or namespace name 'ReadOnlySpan<>' could not be found (are you missing a using directive or an assembly reference?)

Library\PackageCache\com.cysharp.zstring@2.3.1\Number\BitOperations.cs(31,24): error CS0246: The type or namespace name 'ReadOnlySpan<>' could not be found (are you missing a using directive or an assembly reference?)

Library\PackageCache\com.cysharp.zstring@2.3.1\FastNumberWriter.cs(11,42): error CS0246: The type or namespace name 'Span<>' could not be found (are you missing a using directive or an assembly reference?)

Library\PackageCache\com.cysharp.zstring@2.3.1\FastNumberWriter.cs(173,43): error CS0246: The type or namespace name 'Span<>' could not be found (are you missing a using directive or an assembly reference?)

Library\PackageCache\com.cysharp.zstring@2.3.1\FormatHelper.cs(13,95): error CS0246: The type or namespace name 'ReadOnlySpan<>' could not be found (are you missing a using directive or an assembly reference?)

Library\PackageCache\com.cysharp.zstring@2.3.1\FormatHelper.cs(45,108): error CS0246: The type or namespace name 'ReadOnlySpan<>' could not be found (are you missing a using directive or an assembly reference?)

Library\PackageCache\com.cysharp.zstring@2.3.1\IResettableBufferWriter.cs(8,51): error CS0246: The type or namespace name 'IBufferWriter<>' could not be found (are you missing a using directive or an assembly reference?)

Library\PackageCache\com.cysharp.zstring@2.3.1\FormatHelper.cs(14,35): error CS0246: The type or namespace name 'IBufferWriter<>' could not be found (are you missing a using directive or an assembly reference?)

Library\PackageCache\com.cysharp.zstring@2.3.1\FormatHelper.cs(46,35): error CS0246: The type or namespace name 'IBufferWriter<>' could not be found (are you missing a using directive or an assembly reference?)

Library\PackageCache\com.cysharp.zstring@2.3.1\PreparedFormat.cs(255,35): error CS0246: The type or namespace name 'IBufferWriter<>' could not be found (are you missing a using directive or an assembly reference?)

Library\PackageCache\com.cysharp.zstring@2.3.1\PreparedFormat.cs(45,35): error CS0246: The type or namespace name 'IBufferWriter<>' could not be found (are you missing a using directive or an assembly reference?)

There are many similar compiler errors as well. This occurs on Unity 2020.2.1f1 on Windows 10.

@neuecc
Copy link
Member

neuecc commented Jan 22, 2021

upm package does not include managed dlls.
https://github.com/Cysharp/ZString/tree/master/src/ZString.Unity/Assets/Plugins
require to add manually(outside of package).

@JesseTG
Copy link
Author

JesseTG commented Jan 22, 2021

There are UPM packages that provide DLLS, though. Is there any reason those DLLs can't be split off into separate packages that ZString uses as a dependency?

@neuecc
Copy link
Member

neuecc commented Jan 22, 2021

Other packages that using System.Memory etc(ZLogger, MessagePack-CSharp, etc) are exists.
If you include System.Memory, etc., the possibility of conflicts occurs.

@JesseTG
Copy link
Author

JesseTG commented Jan 22, 2021

Those are all your packages, right? So can't you make all of them depend on these DLLs (or just the ones that they need at least)? Given how popular your packages are, I bet if you wrapped System.Memory and the like in UPM packages everyone would coalesce around them quickly.

@neuecc
Copy link
Member

neuecc commented Jan 22, 2021

These packages are certainly under my control, but System.* itself is used by others, so there is always the possibility of conflicts.
Unity does not have a binding redirection mechanism, so if the dll versions are different, it will not work properly.
Unless the UPM mechanism itself changes (or unless System.Memory is included in the standard libs to support netstandard2.1/net5), there is no good solution.

@JesseTG
Copy link
Author

JesseTG commented Jan 22, 2021

Dang. Is there any reason you couldn't prepare a package containing a version of these libraries that's known to work with your packages but is technically an optional dependency? Right now ZString and ZLogger are the only libraries I use that require System.Memory and company (and if that changes I'll worry about it then).

@GilbertoBitt
Copy link

i recommend using the samples of the package just to import the dlls

@JesseTG
Copy link
Author

JesseTG commented Jan 24, 2021

Yeah that's what I do now, but I'd rather keep dependencies out of my git repo where possible.

@neuecc
Copy link
Member

neuecc commented Apr 6, 2021

merged, thanks all.

@neuecc neuecc closed this as completed Apr 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants