Closed robertmuehsig closed 2 months ago
// net8.0
// without namespace
Console.WriteLine(typeof(Sample).Namespace);
Console.WriteLine(typeof(Sample).Namespace is null);
public class Sample
{
public string Name { get; set; }
}
output:
True
the namespace of Sample
is null so Jint can't get ctor by your namespace
so Jint should not be to blame
it's net's features but not bug
So maybe the interop code should check for namespace-less types. Probably with an option though, if we can't register a null
namespace.
It's now possible to import the empty namespace and get types from there. See #1888 and its test case.
This is part of the latest 3.1.3 release.
Version used
3.1.2
Describe the bug
I created a small demo app (.NET 8 Console App) and played with the .NET Interopt, but encountered a strange "bug", but I'm not sure if this is "by design".
To Reproduce
Program.cs:
Sample.cs:
Expected behavior
It should found the "Sample" constructor, but it fails with:
Additional context
If I add an explicit Namespace to "Sample.cs" it works.
Not a big deal, but it took me a few minutes to figure out why it didn't work.