Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Registering any class with a copy constructor throws a System.TypeInitializationException #159

Open
FunkyLambda opened this issue Jun 18, 2023 · 1 comment

Comments

@FunkyLambda
Copy link

FunkyLambda commented Jun 18, 2023

Steps to reproduce:

  1. Define the following:
public interface IFoo
{
}

public class Foo : IFoo
{
  public Foo()
  {
  }
  
  public Foo(Foo copy)
  {
  }
}
  1. Now register:
TinyIoCContainer.Current.Register(typeof(IFoo), typeof(Foo));
// Does not make a difference if using AsSingleton() or AsMultiInstance().
  1. Run application.

Expected behaviour:
Should just work.

Actual Behaviour:
You receive a System.TypeInitializationException during application startup.

Observations:

  1. Removing the copy constructor results in the exception not being thrown.

Environment:
Xamarin.Forms 4.8.0.1821
NETStandard.Library 2.0.3

@niemyjski
Copy link
Collaborator

Hello,

Can you please create a pr that contains a test for this as well as a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants