Skip to content

Conversation

@mhbuck
Copy link
Contributor

@mhbuck mhbuck commented Mar 24, 2025

Investigating how props can remove the usage of expressions as part of #7246

Copy link
Contributor Author

@mhbuck mhbuck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still not made movement on the Create<TActor>(params object[] args) signature but interesting that so much is passing currently

/// <exception cref="ArgumentException">This exception is thrown if <paramref name="type" /> is an unknown actor producer.</exception>
public Props(Deploy deploy, Type type, params object[] args)
#pragma warning disable CS0618 // Type or member is obsolete
: this(CreateProducer(type, args), deploy, args) // have to preserve the "CreateProducer" call here to preserve backwards compat with Akka.DI.Core
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a feeling removing this is not supposed to happen. Still need to understand any test failures.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed it from #7903 - it's a legacy function call that we probably don't need any more.

/// </summary>
public static readonly Props None = null;
private Type _inputType;
private Type _outputType;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expect this removal needs to come back in mainly due to the serialisation comment below on the TypeName property

//for serialization
private set => _inputType = Type.GetType(value);
get => _producer.ActorType.AssemblyQualifiedName;
//private set => _producer.ActorType = Type.GetType(value);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented out for now

var args = newExpression.Arguments.Count > 0 ? newExpression.GetArguments() : NoArgs;

return new Props(new ActivatorProducer(typeof(TActor), args), DefaultDeploy, args){ SupervisorStrategy = supervisorStrategy };
return new Props(new FactoryProducer<TActor>(factory), DefaultDeploy, NoArgs) { SupervisorStrategy = supervisorStrategy };
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Func being used in the factory producer

}

private class FactoryConsumer<TActor> : IIndirectActorProducer where TActor : ActorBase
private class FactoryProducer<TActor> : IIndirectActorProducer where TActor : ActorBase
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed to be more inline with the interface.

public ActorBase Produce()
{
return Activator.CreateInstance(ActorType, _args).AsInstanceOf<ActorBase>();
return (ActorBase)Activator.CreateInstance(ActorType, _args);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if there is a preference here.

{
var copy = Copy();
var original = copy.Deploy;
//var original = copy.Deploy;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed as the todo below has commented it out.

@Aaronontheweb Aaronontheweb added the akka.net v1.6 Akka.NET v1.6-related issues label Mar 24, 2025
mhbuck added 3 commits August 17, 2025 18:06
I have a feeling that CreateProducer might still be needed but testing this out for now.
Moved some methods around to group better
@mhbuck mhbuck changed the base branch from v1.6 to dev August 17, 2025 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

akka.net v1.6 Akka.NET v1.6-related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants