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

Modifications in order to make multiple classes become public #310

Merged
merged 37 commits into from
May 21, 2024

Conversation

alexmustata19
Copy link
Collaborator

No description provided.

@alexmustata19 alexmustata19 changed the title [WIP] Multiple public constructors [WIP] Multiple public classes Mar 27, 2024
@alexmustata19 alexmustata19 changed the title [WIP] Multiple public classes Modifications in order to make multiple classes become public Apr 2, 2024
@alexmustata19 alexmustata19 force-pushed the feature/multiple_public_constructors branch from a041819 to 5d160a1 Compare April 2, 2024 09:37
@alexmustata19 alexmustata19 marked this pull request as ready for review April 11, 2024 08:26
@alexmustata19 alexmustata19 force-pushed the feature/multiple_public_constructors branch from af9c744 to f6d193a Compare April 15, 2024 06:50
Copy link
Collaborator

@gabriela-lungu-uip gabriela-lungu-uip left a comment

Choose a reason for hiding this comment

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

The framework for these types of changes is as follows:

  1. transition the class from internal to public
  2. transition back all items from the class that were marked as public to internal (and do not need to be public for the current GEH task)

This way we will many more code changes but less functional/interface ones

@@ -12,7 +12,7 @@ namespace System.Activities;
using Runtime;
using Validation;

internal static class ActivityUtilities
Copy link
Collaborator

Choose a reason for hiding this comment

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

there are still some methods public here, do you need them all?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

CacheRootMetadata must remain public in order to not break reflection implementation in other projects.
We use CreateFaultBookmark(FaultCallback onFaulted, ActivityInstance owningInstance) & CreateCompletionBookmark(CompletionCallback onCompleted, ActivityInstance owningInstance) directly so they need to remain public.
Overloads of CreateCompletionBookmark were left also public.

@@ -1158,18 +1158,18 @@ internal override void OnInternalCacheMetadata(bool createEmptyBindings)

public struct ChildActivity : IEquatable<ChildActivity>
Copy link
Collaborator

Choose a reason for hiding this comment

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

make only ChildActivity internal, and all items in it can remain unchanged

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

CacheRootMetadata method needs to be public. For this to happen ProcessActivityCallback needs to be public which implies that ChildActivity and ActivityCallStack needs to be both public.

@@ -1184,18 +1184,18 @@ public class ActivityCallStack
private int _nonExecutingParentCount;
private readonly Quack<ChildActivity> _callStack;

public ActivityCallStack()
Copy link
Collaborator

Choose a reason for hiding this comment

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

change ActivityCallStack to internal and all items in it can remain unchanged

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Explained in ChildActivity comment the situation.

@alexmustata19 alexmustata19 force-pushed the feature/multiple_public_constructors branch from 53a08bc to 54107c0 Compare April 26, 2024 08:11
@@ -0,0 +1,12 @@
using System.Activities.Runtime;
Copy link
Collaborator

Choose a reason for hiding this comment

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

we don't need to expose these methods for the current PR on Studio, but they might be useful to replace the reflection used for exception handler at some point.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed this class. Fixed.

{
private bool _checkForCancelation;
private bool _needsToGatherOutputs;

protected CompletionCallbackWrapper(Delegate callback, ActivityInstance owningInstance)
public CompletionCallbackWrapper(Delegate callback, ActivityInstance owningInstance)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This change doesn't do anything since it's an abstract class.
protected rather than public is better from a readability perspective.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Reverted the constructor back to protected. Fixed.

… to be compatible with GEH Json Persistence requirements.
… CallbackWrapper, CompletionCallbackWrapper, FaultCallbackWrapper, CompletionBookmark and FaultBookmark classes.
…tionCallbackWrapper, FaultCallbackWrapper, CompletionBookmark and FaultBookmark classes.
…, CompletionCallbackWrapper, FaultCallbackWrapper, CompletionBookmark and FaultBookmark classes."

This reverts commit 232b841.
… the ActivityUtilities class FinishCachingSubtree & ProcessActivityInstanceTree methods.
…o public the ActivityUtilities class FinishCachingSubtree & ProcessActivityInstanceTree methods."

This reverts commit 8f7665a.
…CompletionBookmark methods of ActivityUtilities static class.
@alexmustata19 alexmustata19 force-pushed the feature/multiple_public_constructors branch from b668ca5 to 31a6123 Compare May 13, 2024 08:29
public ActivityInstance ActivityInstance
public Delegate Callback { get; set; }

internal ActivityInstance ActivityInstance
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is accessed with reflexion. are we sure we did not break it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Reverted ActivityInstance property to be public.

@@ -4,7 +4,7 @@
namespace System.Activities.Runtime;

[DataContract]
internal class CompletionBookmark
public class CompletionBookmark
Copy link
Collaborator

Choose a reason for hiding this comment

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

do you still need this to be public?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed. Reverted to internal.

@@ -7,7 +7,7 @@ namespace System.Activities.Runtime;
[KnownType(typeof(ActivityCompletionCallbackWrapper))]
[KnownType(typeof(DelegateCompletionCallbackWrapper))]
[DataContract]
internal abstract class CompletionCallbackWrapper : CallbackWrapper
public abstract class CompletionCallbackWrapper : CallbackWrapper
Copy link
Collaborator

Choose a reason for hiding this comment

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

do you still need this to be public?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed. Reverted to internal.

@@ -4,7 +4,7 @@
namespace System.Activities.Runtime;

[DataContract]
internal class FaultBookmark
public class FaultBookmark
Copy link
Collaborator

Choose a reason for hiding this comment

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

do you still need this to be public?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed. Reverted to internal.

private ActivityInstance _activityInstance;

protected internal CallbackWrapper() { }

public CallbackWrapper(Delegate callback, ActivityInstance owningInstance)
{
ActivityInstance = owningInstance;
_callback = callback;
Callback = callback;
Copy link
Collaborator

Choose a reason for hiding this comment

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

The rename of the backing field is also a risk.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added back backing field _callback.

@@ -56,13 +55,13 @@ internal string SerializedDeclaringTypeName
}

[DataMember(Name = "ActivityInstance")]
internal ActivityInstance SerializedActivityInstance
public ActivityInstance SerializedActivityInstance
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this needed as public?

Please go through the PRs again, making sure every change can be justified.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Reverted SerializedActivityInstance property to be internal, because isn't used anywhere in our repo.

…e get and set methods that operate on the _callback backing field. Reverted the usages in the class tto _callback. Reverted SerializedActivityInstance property to be internal. Reverted ActivityInstance property to be public.
@@ -19,19 +19,19 @@ public CompletionBookmark(CompletionCallbackWrapper callbackWrapper)
}

[DataMember(EmitDefaultValue = false, Name = "callbackWrapper")]
internal CompletionCallbackWrapper SerializedCallbackWrapper
public CompletionCallbackWrapper SerializedCallbackWrapper
Copy link
Collaborator

Choose a reason for hiding this comment

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

changes to this file are no longer needed

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed.

@@ -35,7 +35,7 @@ internal bool SerializedNeedsToGatherOutputs
set => _needsToGatherOutputs = value;
}

public void CheckForCancelation() => _checkForCancelation = true;
internal void CheckForCancelation() => _checkForCancelation = true;
Copy link
Collaborator

Choose a reason for hiding this comment

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

changes to this file are no longer needed

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed.

@@ -14,12 +14,12 @@ public FaultBookmark(FaultCallbackWrapper callbackWrapper)
}

[DataMember(Name = "callbackWrapper")]
internal FaultCallbackWrapper SerializedCallbackWrapper
Copy link
Collaborator

Choose a reason for hiding this comment

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

changes to this file are no longer needed

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed.

@gabriela-lungu-uip gabriela-lungu-uip merged commit bfa4a60 into develop May 21, 2024
2 checks passed
@gabriela-lungu-uip gabriela-lungu-uip deleted the feature/multiple_public_constructors branch May 21, 2024 14:10
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.

None yet

3 participants