Compiler errors (not correctly resolved types) where I don't expect them

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.

For the first error, there might me more to defining a custom Attribute on Island/WebAssembly than just declaring it same as in .NET. I’ll have to check with the team.

The other errors seem specific to the namespace you are using being System, which on Island is an alias for “RemObjects.Elements.System”, but still odd. I’ll log an issue, but i suggest you use “RemObjects.Elements.System” instead.

Great, thanks! Using RemObjects.Elements.System instead of only System works fine! Also for the attribute.

Nitty gritty details I need to learn :wink:

Logged as bugs://E25876.

Yeah, egg on face, they were all the same error :wink:

And in case of the redirect totally understandable, since I was in the wrong namespace.

I seem to have a tendency to exactly touch a lot of these kinds of edge cases when playing around with sth. for the very first time :wink:

Sort of. I still think this should have worked. It seems “namespace System” but you into the scope of the redirected namespace, but then still added the new types into actual System (which of course then was not in scope). IMHO they should be put into the redirect, and thus have worked. :wink:

That’s great. i love finding issues like that and gettig them fixed.

bugs://E25876 was closed as fixed.

I’ll have a new build with these fixes in your Personal Download folder in the next 30 minutes or so.

Update: done.