Austin Wise
Forwarding calls to string.Create with custom culture info.
And to directly address why your Inv function did not worked as you had hoped and why string.Create() does nothing with the provider parameter, it is helpful to see how the compiler transforms calls to string.Create.
https://sharplab.io/#v2:CYLg1APgAgTAjAWAFBQAwAIpwHQHEA2A9gEYCG+AlgF6kAuFhAdgNzLJQDMmcAbJjOgDC6AN7J0EzFyx8sGALIAKAGZE66ZQEpR4yXqgB2bqmyCATgFM6FxYICu+WncsBJRssLY3AN1JmKpIy09o7OFgA06AAkAETKIKLKAL4xmqxIeknISUA===
You can see the compiler generated code uses the provider before it calls string.Create.
5 replies
Forwarding calls to string.Create with custom culture info.
Here is an example of how to create your own interpolated string handler that uses invariant culture to format values: https://gist.github.com/AustinWise/7464c30f6bc9b531020f00abbf6f9ae4
5 replies
Forwarding calls to string.Create with custom culture info.
You could write your own interpolated string handler that always uses invariant culture. Here are some docs:
https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/tutorials/interpolated-string-handler
5 replies
Why ins't inlining working here?
As others have mentioned, if you change the program to use the value returned by the function (to prevent dead code elimination) and view the JIT Asm, you can see the inlining take effect. Here is a modified version of your program that does that:
https://sharplab.io/#v2:C4LghgzgtgPgAgJgIwFgBQcAMACOSAsA3OlrkgHQBKArgHbACWUApuQMID2UADgwDbMATgGUhANwYBjZhGJoSCMgHZ0Ab3TZNZAGzYG9bAFkw+gBR5MAbQC62MIIDmEAJQat6tFq+4l2ACIcAGIcHKZImAA0do4Q5AAyzLQOwAAWznJeAL5umjnYlobMqRwAJgCSPHymhcXllQDy3IwctLEAgg4OgjIQDGLMZbR8+voOztZ5eLr6wP5BIaYzelFLAEaunu55XnC+DNgA1NirGVrZaJlAA===
7 replies
"Object reference not set to an instance of an object"
Here is the reference on where the parameterless constructor came from:
https://github.com/dotnet/csharpstandard/blob/standard-v6/standard/structs.md#1549-constructors
there are other behavior differences that can cause problems if you change an existing class to a struct. Like if someone passed your Board to a method that change some of the state, the caller would no longer see the changes after the method returns. So you might want to leave it as class for backwards compatibility, in addition to the reasons Jimmacle mentioned.
59 replies
✅ Containers orchestration
Besides the Kubernettes based solutions mentioned above, there are some cloud services that can take a container and run it with minimal configuration. I'm most familiar with my employer's Google Cloud Run product. Microsoft has Azure Container Apps. The nice thing about these is they are super simple to setup. Also they support scaling to zero, which is nice for hobby projects.
7 replies