-
Notifications
You must be signed in to change notification settings - Fork 158
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
New-MarkdownHelp
implementation for v2
#520
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of nullable-reference is a little confusing, and some seem wrong as #nullable enable
is not added to all the new files. I suggest to apply #nullable enable
to all new files, and that will help you get compiler's help to see if any use of nullable-reference is correct.
@daxian-dbw This is ready for re-review. I have removed the StringBuilder pool implementation as it was causing high memory consumption issues. I will include it in separate PR. |
test/Microsoft.PowerShell.PlatyPS.Tests/MarkdownWriterSettings.Tests.cs
Outdated
Show resolved
Hide resolved
@adityapatwardhan Don't copy the exact
You ran into a memory issue because you didn't clear the BTW, I don't recommend to use the It might be fine to use this syntax in a small size code base, but I don't recommend to use it in the PowerShell repo. |
Thanks for the feedback. Do you think ObjectPool change is needed in this PR or can be brought in later? |
Since we have been talking about it, and the changes to correct the memory issue is relatively simple, let's maybe get it done in this PR? |
@adityapatwardhan But not trying to push it. I'm totally fine if you want to do it in a separate PR. So it's up to you 😄 |
@daxian-dbw you convinced me against the usage of |
@adityapatwardhan You can absolutely use it when it's appropriate, such as for initializing the file/property members. But just be cautious when using it in other places 😄 |
@daxian-dbw It is ready for review. |
.Net team announced End Of Support for Net461. It seems time to move from net461 to net462. |
I wish we can move directly to netstandard2.0, which implies that we support .NET Framework 4.7.2+ (.NET versions prior to 4.7.2 did NOT ship the |
I will make that change in a different PR. Needs to be tested in older supported OSes. I can change to |
@adityapatwardhan No need to do that now. The end of support is on April 26, 2022 |
@daxian-dbw Addressed your comments. Keeping it |
src/NewMarkownHelpCommand.cs
Outdated
/// </summary> | ||
[Cmdlet(VerbsCommon.New, "MarkdownHelp", HelpUri = "https://go.microsoft.com/fwlink/?LinkID=2096483")] | ||
[OutputType(typeof(FileInfo[]))] | ||
public sealed class NewMarkdownHelpCommand : PSCmdlet, IModuleAssemblyCleanup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's recommended to use a separate type for the IModuleAssemblyCleanup
logic, with a name that is easy to be recognized for its functionality, like "ModuleCleanUp".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, makes sense since it is for cleaning up the module, not just a cmdlet.
public void Dispose() | ||
{ | ||
Dispose(disposing: true); | ||
GC.SuppressFinalize(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you expect CommandHelpMarkdownWriter
to be inherited by another type? If not, then add sealed
to the type declaration, and then just move the logic in Dispose(bool disposing)
here and remove the GC.SuppressFinalize
call. You don't even need the disposedValue
field unless you are checking it somewhere else in the code and will throw a ObjectDisposedException
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
public void Dispose() | ||
{ | ||
Dispose(disposing: true); | ||
GC.SuppressFinalize(this); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
New-MarkdownHelp
build.ps1