Create some error silencing attributes

I have this class

private struct DummyType : IComponentData, BeforeSaveIComponentData, AutoSaveIComponentData, ISharedComponentData, AutoSaveISharedComponentData {
            byte[] BeforeSaveIComponentData.GenerateExtraData() {
                throw new NotImplementedException();
            }

            byte[] AutoSaveISharedComponentData.GenerateSharedData() {
                throw new NotImplementedException();
            }
        }

It’s sole purpose is to let me do this MethodInfo methodInfoShared = ((Action<SQLiteConnection, EntityQueryBuilder>)SaveISharedComponentData<DummyType>).Method.GetGenericMethodDefinition(); for methods that require either IComponentData or ISharedComponentData generics.
A [IGNORE_UNITY_COLLECTIONS_CHECKS] attribute would be perfect for it, so I can silence the error for it, but keep for other things

That’s an example of what I want, but this one does not solve the issue, as the error I get is for implementing both IComponentData and ISharedComponentData

What is the error message you are getting?

ArgumentException: Component EverydayEngine.Save+DummyType can only implement one of IComponentData, ISharedComponentData and IBufferElementData

The error is pretty straightforward. That’s not a safety restriction. That’s a restriction that the internals of Entities relies upon. In particular, ComponentType assumes that the type is only one of them using flags for when adding or removing components.

Make an ISharedComponentData that has a DummyType as a field inside of it.

You are completely missing the point, I just want to silence the error, I do not intend to use the DummyType as an IComponentData neither ISharedComponentData

The issue isn’t that you aren’t using the ICD or ISCD, it is that you are defining it. When the project starts up, TypeManager looks through all the assemblies and finds all the ICDs and ISCDs and tries to build a handle for them for the archetype system. When it reaches DummyType, it doesn’t know how to build such a handle and errors out.

I have no idea what you are trying to do, but you might be able to define DummyType as a generic to get the TypeManager to not see it.

I believe the original post explicitly explain what I am trying to do, but I will reiterate with as much clarity I can. I want a reference to a MethodInfo of a generic method, and the way I like the most, to get exactly the MethodInfo I need, is as I did on the original post code example. That method of getting the MethodInfo requires me, at least on the C# version Unity uses, to declare a generic type with it, so I created a type, whose only reason to exist, is to be used as the generic type on the method declaration. This type happens to be a type that implements all 3 IComponentData, ISharedComponentData and IBufferElementData interfaces, which are all, according to the ECS implementation, mutually exclusive, and when TypeManager sees a Type with more than one of those, it complains.
What I want from the ECS developers, is some means, preferably an attribute, to exclude a Type from TypeManager 's safety check, so that I can use my Type as it’s mean to be used, without either having to see the error at startup, or disabling the safety check

Thanks for the explanation. I have a better idea of what you are doing, though I can’t even imagine what a use case would be for something like that which doesn’t have a better DOTS alternative. Anyways, here are a few suggestions:

  1. Create an IcdDummyType : IComponentData, an IscdDummyType : ISharedComponentData, and an IBedDummyType, ect. T4 might be useful if this list grows large.
  2. Make DummyType generic and always specify it as DummyType.
  3. Load DummyType from an assembly dynamically after a World is created.

I don’t know if you ever got something working, but as I was investigating how to auto-gen implementations of generic components for a new version of my framework, I discovered an attribute called [DisableAutoTypeRegistration]. I think this was exactly what you were asking for.