YamlDotNet icon indicating copy to clipboard operation
YamlDotNet copied to clipboard

Attempt to add a Unity project to test compilation

Open aaubry opened this issue 4 years ago • 4 comments

Another take at #634

aaubry avatar Sep 28 '21 23:09 aaubry

Thanks! That was quite convenient, I have to say.

I'm now working your changes into the package that I'm going to upload. But I'm getting a lot of warnings (using Unity 2021.1.18f1).

The following classes seem to conflict with .net standard 2.0 libraries:

  • ConcurrentDictionary
  • IReadOnlyDictionary
  • IReadOnlyList
  • Lazy
  • LazyBuilder

Then at the bottom of TypeConverter.cs, there seems to be a portion of code that is not meant for Unity, but it's going to be if the user doesn't explicitly define the symbol "UNITY" in their project settings.

A lot of files seem to expect a "nullable context". This is easily fixable by adding a file 'csc.rsp' next to the assembly definition file, with the line '-nullable:enable'.

At the end of all that, I was left with these two warnings:

Assets\Plugins\YamlDotNet\RepresentationModel\YamlDocument.cs(61,18): warning CS8618: Non-nullable property 'RootNode' is uninitialized. Consider declaring the property as nullable. Assets\Plugins\YamlDotNet\Serialization\YamlAttributeOverrides.cs(97,35): warning CS8600: Converting null literal or possible null value to non-nullable type.

Should I turn off the warnings, or is there some change that should be done?

image

steinbitglis avatar Oct 03 '21 09:10 steinbitglis

It seems that the following files and folders in Portability are sufficient, and compiles with only the two mentioned warnings. image

steinbitglis avatar Oct 03 '21 10:10 steinbitglis

I could also delete DeconstructionExtensions.cs and TargetFrameworkAttribute.cs, and everything seems fine.

steinbitglis avatar Oct 03 '21 10:10 steinbitglis

I have fixed every issue I could find and submitted a package to the asset store. I guess I spent most of the time updating the store images. I'll try and put together a pull request against unity-compatible, so you can have a look, but I'll have to make dinner first now 😅

steinbitglis avatar Oct 03 '21 16:10 steinbitglis