-
Notifications
You must be signed in to change notification settings - Fork 344
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
Spec updates for GenerationId and Bootstrap C# API #1284
Spec updates for GenerationId and Bootstrap C# API #1284
Conversation
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
std::cout << "Hello World!\n"; | ||
|
||
// Cleanup | ||
MddBootstrapShutdown(); |
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.
Consider showing adding a wil::unique_call
here that handles calling this shutdown method, even on exceptions.
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.
As discussed on the other PR, failure to call shutdown is a minor nit. Is automatic cleanup important? And if so, is that just a C++ thing or should we also provide it for C#?
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 good to show proper lifecycle behavior in a sample, even if someone chooses to not do it.
Maybe a wrapper type for C# that implements IDisposable as a sample, so you can say "var winappsdkref = Bootstrap.Initialize()" or something
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.
Yeah I was thinking of IDisposable. Will cook something up
Please check the related implementation PR #1274. Currently blocked by you. Feedback's been addressed. Would be helpful to get that and add this wrapper in a subsequent (smaller) PR than have it all await perfection.
std::cout << "Hello World!\n"; | ||
|
||
// Cleanup | ||
MddBootstrapShutdown(); |
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 good to show proper lifecycle behavior in a sample, even if someone chooses to not do it.
Maybe a wrapper type for C# that implements IDisposable as a sample, so you can say "var winappsdkref = Bootstrap.Initialize()" or something
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
* Spec updates for GenerationId and Bootstrap C# API * Incorporated feedback * Fixed typo (sheepish grin) * Incorporated feedback
Update spec for the Bootstrap C# API and Dynamic Dependency GenerationId property. Spec update (changes in specs/dynamicdependencies)
Why Bootstrap C# API? The Bootstrapper provides a Flat-C API taking multiple optional parameters. The Bootstrap C# API is provided as a .NET assembly with the following features:
Function overloads to make optional parameters optional
Bootstrap APIs scoped to a standard namespace and class
Choice of error handling via throw exceptions or returned HRESULT
C# friendly syntax implementing the necessary P/Invoke definition to adds the Bootstrap Flat-C API..
NOTE: This is a revised form of MddBootstrap.cs in 0.8-preview1's samples incorporating improvements based on community feedback.
NOTE: This provides a natural C# form of the Bootstrap API, which has only been available as a Flat-C API. The Bootstrap API is not provided as a WinRT API due to the nature of the Bootstrap API's required use before accessing the Windows App SDK. Although possible for C# to use a WinRT API via RegFreeWinRT it requires additional developer effort (Fusion manifest isn't seamlessly integrated into the C# developer experience). This C# API complements the Flat-C format to provide a natural and frictionless C# developer experience, to a degree not as easily accomplished with a WinRT API at this time.
Why Generation Id? Generation Id is a unique value changed whenever a process' package graph is altered. This is used to quickly and efficiently detect if the package graph has changed since the last time one examined it. This is of import if package graph sensitive data is computed and cached e.g. when the package graph is used as a search order for resources that are cached or otherwise expensive to recompute. One can remember the generation id when retrieving the package graph to compute some data, then later, before using that data, get the current Generation Id to check if the package graph is the same and the data's safe to use, or the package graph has changed requiring query'ing the package graph, scrapping the previously computed (now stale) data and recomputing it.