Skip to content

Conversation

Lucidiac
Copy link

Improved codegen error messages to show which member is failing and its type. Was getting tired of the wild goose chase to figure out what wasn't working.

@FirstGearGames
Copy link
Owner

FirstGearGames commented Jul 19, 2025 via email

@Lucidiac
Copy link
Author

I was on 4.6.2 but the scripts I modified had no diffs so I assumed the feature untouched. Let me check out latest version and see if this was for nothing 😂

@Lucidiac
Copy link
Author

Lucidiac commented Jul 19, 2025

Also I think my implementation here still has some false positives but its like 90% there.

Edit: Seems to be working correctly now

@Lucidiac
Copy link
Author

Lucidiac commented Jul 19, 2025

Okay so I just compared against a more recent fishnet version to ensure I didn't reimplement anything but to answer your question the difference is that instead of this:

FishNet.CodeGenerating.ILCore.FishNetILPP: (0,0): error  - ItemDefinition is not a supported type. Use a supported type or provide a custom serializer

You get this, and know specifically what is failing, beyond just which type it is.

FishNet.CodeGenerating.ILCore.FishNetILPP: (0,0): error  - ItemDefinition is not a supported type. Use a supported type or provide a custom serializer. Trace: nested field 'class/struct 'ItemInstance'' -> nested field 'property 'ItemDefinition' (of type 'ItemDefinition') in class 'ItemInstance''

@FirstGearGames
Copy link
Owner

FirstGearGames commented Jul 20, 2025

Can you show me your test code?

I used this...

using System;
using FishNet.CodeGenerating;

namespace TheNamespace
{

    [IncludeSerialization]
    public class SomeParentClass
    {
        public ItemDefinition ItemInstance;
    }

    public struct ItemDefinition
    {
        public IntPtr Pointer;
    }

}

And got the following on 4.6.12 (detailed logging introduced in 4.6.10).

(0,0): error  - CreateWrite: System.IntPtr is an unsupported type. Trace:  TypeRef [TheNamespace.ItemDefinition].
(0,0): error  - CreateRead: System.IntPtr is an unsupported type. Trace:  TypeRef [TheNamespace.ItemDefinition] FieldDef [Pointer].[Pointer].

@Lucidiac
Copy link
Author

Let me take a look, I was primarily testing with UnityEngine.Object types as members of a serialized class but it may not be running correctly for things serialized via the attribute.

@FirstGearGames
Copy link
Owner

Let me take a look, I was primarily testing with UnityEngine.Object types as members of a serialized class but it may not be running correctly for things serialized via the attribute.

I know we discussed this but I do not recall what we determined entirely. Was it that yours covers some sections mine didn't?

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

Successfully merging this pull request may close these issues.

2 participants