I’m trying to convert some existing C# code that uses relatively basic .NET types, i.e. the EventHandler
delegate and the EventArgs
type that comes with it.
Since these types aren’t available in Island and Elements RTL, I wanted to provide them myself.
So I created this file:
namespace System
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Delegate, Inherited = false)]
public class SomeAttribute : Attribute
{
public SomeAttribute()
{
}
}
[Some]
public class SomeEventArgs
{
public static readonly SomeEventArgs Default = new SomeEventArgs();
public SomeEventArgs()
{
}
}
[Some]
public delegate void SomeEventHandler(object sender, SomeEventArgs e);
}
Well, in fact I copied the orginal EventHandler
, EventArgs
and the SerializableAttribute
(since both are marked with that) from the System
namespace into the project, as individual files first, but this is a smaller repro all within a single file.
I get the following errors:
The default namespace of my BaseTypes
WASM static library project is set to System
, so there should be no confusion about this.
In MS C# this builds fine, as it references types in the same namespace (System), and we’re within that same namespace. Also using System;
does not help it to find the types.
I’m probably simply holding it the wrong way. Is there a setting that I missed so that it can resolve the types in the very same project (even in the same file) correctly?
Edit: I find it even weirder, because it can’t resolve SomeEventArgs
within the very same type.