Skip to content

DefaultTypePool requires JIT compilation #51

@morgoth990

Description

@morgoth990

I'm compiling the library in a project without JIT compilation.
On an older version everything was working fine but now I'm receiving an exception in DefaultTypePool.Creator.

private static readonly Func<T> Creator = Expression.Lambda<Func<T>>(Expression.New(typeof(T))).Compile();

public object Get()
{
    lock (_pool)
    {
            if (_pool.Count > 0)
            {
                return _pool.Dequeue();
            }
    }
    return Creator();
}

The Creator is compiling at runtime but without JIT compilation can't work.
Is the Creator needed?
Can't DefaultTypePool.Get() just return new T() ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions