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

Added ActorReference creation from the ActorBase class informations #1277

Conversation

m3nax
Copy link
Contributor

@m3nax m3nax commented Apr 29, 2024

Description

  • Handled the case where you want to create an ActorReference inside the actor implementation from informations found in the Actor base class.
  • Added missing test for ActoreReference.Get method.
  • Handled: // TODO check for ActorBase in the code of ActorReference class.

Example:

public interface ITestActor: IActor
{
  Task TestMethod();
}

public class TestActor: Actor, ITestActor
{
  public TestActor(ActorHost host)
    : base(host)
  {
  }

  public Task TestMethod()
  {
    // Currently an ArgumentOutOfRangeException is thrown when a call to ActorReference.Get(this) is executed
    //  because the Actor parameter cannot be cast to the IActorProxy interface.
    // The only way to create an ActorReference from the Actor implementation is as follows
    var referenceOldWay = new ActorReference { ActorId = this.Id, ActorType = this.Host.ActorTypeInfo.ActorTypeName };

    // In this case the ActorReference must be created based on the informations
    //  contained in the Actor base class with the .Get method already present in the object
    // This approach unifies the methodology already used to create an ActorReference from an IActorProxy
    var referenceNewWay = ActorReference.Get(this);
  }
}

Issue reference

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

@m3nax m3nax requested review from a team as code owners April 29, 2024 21:45
@m3nax m3nax force-pushed the Added-ActorReference-creation-from-the-actor-base-class branch from b37f235 to c68209e Compare April 29, 2024 21:53
Copy link

codecov bot commented Apr 30, 2024

Codecov Report

Attention: Patch coverage is 87.50000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 67.55%. Comparing base (1b7c9f4) to head (c68209e).
Report is 13 commits behind head on master.

Current head c68209e differs from pull request most recent head 68a1bda

Please upload reports for the commit 68a1bda to get more accurate results.

Files Patch % Lines
src/Dapr.Actors/ActorReference.cs 87.50% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1277      +/-   ##
==========================================
+ Coverage   67.28%   67.55%   +0.26%     
==========================================
  Files         174      174              
  Lines        6025     6041      +16     
  Branches      671      671              
==========================================
+ Hits         4054     4081      +27     
+ Misses       1802     1790      -12     
- Partials      169      170       +1     
Flag Coverage Δ
net6 67.53% <87.50%> (+0.26%) ⬆️
net7 67.53% <87.50%> (+0.26%) ⬆️
net8 67.53% <87.50%> (+0.26%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@m3nax m3nax force-pushed the Added-ActorReference-creation-from-the-actor-base-class branch 2 times, most recently from 40067d4 to a03a213 Compare May 2, 2024 20:02
m3nax and others added 7 commits May 2, 2024 22:06
Signed-off-by: Manuel Menegazzo <manuel.menegazzo@outlook.com>
Signed-off-by: Manuel Menegazzo <manuel.menegazzo@outlook.com>
Signed-off-by: Manuel Menegazzo <manuel.menegazzo@outlook.com>
Signed-off-by: Manuel Menegazzo <manuel.menegazzo@outlook.com>
Signed-off-by: Manuel Menegazzo <manuel.menegazzo@outlook.com>
Signed-off-by: Manuel Menegazzo <manuel.menegazzo@outlook.com>
…rtible to an ActorReference

Signed-off-by: Manuel Menegazzo <manuel.menegazzo@outlook.com>
@m3nax m3nax force-pushed the Added-ActorReference-creation-from-the-actor-base-class branch from a03a213 to 98497a7 Compare May 2, 2024 20:07
@m3nax m3nax closed this May 16, 2024
@m3nax m3nax reopened this May 16, 2024
@m3nax m3nax changed the title Added ActorReference creation from the actor base class informations Added ActorReference creation from the ActorBase class informations May 21, 2024
@m3nax
Copy link
Contributor Author

m3nax commented May 22, 2024

@philliphoff Another transient error seems to have appeared in actions.

Is there a command that can be given to re-execute actions?
Like \assign to assign issues

Recorded error in integration-test / run integration tests (6.0) (pull_request)

Error: Dapr.E2E.Test.GrpcProxyTests.TestGrpcProxyStreamingBroadcast: Grpc.Core.RpcException : Status(StatusCode="Unavailable", Detail="connection error: desc = "transport: Error while dialing: dial tcp 127.0.0.1:37149: connect: connection refused"")

@m3nax m3nax closed this May 27, 2024
@m3nax m3nax reopened this May 27, 2024
Copy link
Collaborator

@philliphoff philliphoff left a comment

Choose a reason for hiding this comment

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

Looks good to me, @m3nax. Just need to resolve the merge conflict and it can be committed.

Signed-off-by: Manuel Menegazzo <manuel.menegazzo@outlook.com>
@m3nax
Copy link
Contributor Author

m3nax commented Jun 6, 2024

@philliphoff Done

@m3nax m3nax requested a review from philliphoff June 7, 2024 19:30
@m3nax
Copy link
Contributor Author

m3nax commented Jun 26, 2024

@philliphoff can be included in v1.14 milestone?

@philliphoff philliphoff added this to the v1.14 milestone Jun 26, 2024
Copy link
Collaborator

@philliphoff philliphoff left a comment

Choose a reason for hiding this comment

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

LGTM

@philliphoff philliphoff merged commit ddce8a2 into dapr:master Jun 26, 2024
10 checks passed
@m3nax m3nax deleted the Added-ActorReference-creation-from-the-actor-base-class branch June 27, 2024 06:49
m3nax added a commit to m3nax/dapr-dotnet-sdk that referenced this pull request Aug 9, 2024
…apr#1277)

* Handled creation of ActorReference from Actor base class

Signed-off-by: Manuel Menegazzo <manuel.menegazzo@outlook.com>

* Updated null check

Signed-off-by: Manuel Menegazzo <manuel.menegazzo@outlook.com>

* Added unit test for GetActorReference from null actore and actor proxy

Signed-off-by: Manuel Menegazzo <manuel.menegazzo@outlook.com>

* Added test for ActorReference created inside Actor implementation

Signed-off-by: Manuel Menegazzo <manuel.menegazzo@outlook.com>

* Updated description

Signed-off-by: Manuel Menegazzo <manuel.menegazzo@outlook.com>

* Fixed test method naming

Signed-off-by: Manuel Menegazzo <manuel.menegazzo@outlook.com>

* Added unit test for exception generated in case the type is not convertible to an ActorReference

Signed-off-by: Manuel Menegazzo <manuel.menegazzo@outlook.com>

---------

Signed-off-by: Manuel Menegazzo <manuel.menegazzo@outlook.com>
m3nax added a commit to m3nax/dapr-dotnet-sdk that referenced this pull request Sep 3, 2024
…apr#1277)

* Handled creation of ActorReference from Actor base class

Signed-off-by: Manuel Menegazzo <manuel.menegazzo@outlook.com>

* Updated null check

Signed-off-by: Manuel Menegazzo <manuel.menegazzo@outlook.com>

* Added unit test for GetActorReference from null actore and actor proxy

Signed-off-by: Manuel Menegazzo <manuel.menegazzo@outlook.com>

* Added test for ActorReference created inside Actor implementation

Signed-off-by: Manuel Menegazzo <manuel.menegazzo@outlook.com>

* Updated description

Signed-off-by: Manuel Menegazzo <manuel.menegazzo@outlook.com>

* Fixed test method naming

Signed-off-by: Manuel Menegazzo <manuel.menegazzo@outlook.com>

* Added unit test for exception generated in case the type is not convertible to an ActorReference

Signed-off-by: Manuel Menegazzo <manuel.menegazzo@outlook.com>

---------

Signed-off-by: Manuel Menegazzo <manuel.menegazzo@outlook.com>
m3nax added a commit to m3nax/dapr-dotnet-sdk that referenced this pull request Sep 4, 2024
…apr#1277)

* Handled creation of ActorReference from Actor base class

Signed-off-by: Manuel Menegazzo <manuel.menegazzo@outlook.com>

* Updated null check

Signed-off-by: Manuel Menegazzo <manuel.menegazzo@outlook.com>

* Added unit test for GetActorReference from null actore and actor proxy

Signed-off-by: Manuel Menegazzo <manuel.menegazzo@outlook.com>

* Added test for ActorReference created inside Actor implementation

Signed-off-by: Manuel Menegazzo <manuel.menegazzo@outlook.com>

* Updated description

Signed-off-by: Manuel Menegazzo <manuel.menegazzo@outlook.com>

* Fixed test method naming

Signed-off-by: Manuel Menegazzo <manuel.menegazzo@outlook.com>

* Added unit test for exception generated in case the type is not convertible to an ActorReference

Signed-off-by: Manuel Menegazzo <manuel.menegazzo@outlook.com>

---------

Signed-off-by: Manuel Menegazzo <manuel.menegazzo@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants