Skip to content

Base_Engine: Create.EngineType returns an arbitrary type in case of a few types matching the unqualified name #3490

Closed
@pawelbaran

Description

@pawelbaran

Description:

As in the title, if there is a few engine types matching the unqualified name, an arbitrary first one is returned:

if (types.Count == 1 || (takeFirstIfMultiple && types.Count > 1))
return types[0];

Instead, a first one after sorting should be returned, as already fixed in Create.Type:

else if (types.Count == 1)
return types[0];
else if (types.Count > 1 && takeFirstIfMultiple)
{
if (!silent)
Compute.RecordWarning($"Ambiguous match: Multiple types correspond the the name provided:\n{string.Join("\n", types.Select(x => x.FullName))}");
return types.OrderBy(x => x.Assembly.FullName).First();
}

The above results in versioning issues in case of fallbacks based on unqualified name. Fix should be as easy as copy-pasting the code from Create.Type to Create.EngineType.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugError or unexpected behaviour

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions