-
Notifications
You must be signed in to change notification settings - Fork 393
Fix NullReferenceException in LocalizationModelDeserializer for malformed keys #9470
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
Conversation
Add null checks in LoadPostActionModels and LoadManualInstructionModels methods to prevent NullReferenceException when processing malformed localization keys. Also add test cases to validate the fix. Co-authored-by: marcpopMSFT <[email protected]>
Co-authored-by: marcpopMSFT <[email protected]>
Co-authored-by: marcpopMSFT <[email protected]>
|
Original report: https://developercommunity.visualstudio.com/t/NullReferenceException-in-LoadPostAction/10971178 |
|
Sorry it's too long ago I don't really recall. I know that after my fixes things were working for my tests in SDK but we had to revert because post actions were not supported in VS and leading to template crashing. |
|
At run-time I'm happy with this. I think the template engine has an authoring-focused NuGet Package that provides helpers - it would be awesome if at build-time these keys could be validated in some way. |
|
I didn't do any validation of this change as I'm not as familiar with this repo. I just scanned the code for where it was making the change and it's description of the change which seemed to be no longer failing at runtime with an empty postaction but rather just skipping it. |
|
/backport to release/10.0.2xx |
|
Started backporting to |
Malformed localization keys cause
NullReferenceExceptioninLoadPostActionModelsandLoadManualInstructionModels. Keys like"postActions/"or"postActions/pa0/manualInstructions//text"result in null/empty values after splitting that are assigned to non-nullable string variables.Changes
LoadPostActionModelsandLoadManualInstructionModelsbefore using grouped keysLoadSymbolModelsandLoadChoiceModelsMalformed keys are now silently skipped instead of throwing exceptions.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
c50vsblobprodcus330.vsblob.vsassets.io./.dotnet/dotnet build src/Microsoft.TemplateEngine.Orchestrator.RunnableProjects/Microsoft.TemplateEngine.Orchestrator.RunnableProjects.csproj(dns block)./.dotnet/dotnet restore src/Microsoft.TemplateEngine.Orchestrator.RunnableProjects/Microsoft.TemplateEngine.Orchestrator.RunnableProjects.csproj --force --force-evaluate(dns block)/home/REDACTED/work/templating/templating/.dotnet/dotnet msbuild /m /nologo /clp:Summary /v:minimal /nr:true /warnaserror /p:TreatWarningsAsErrors=true /p:ContinuousIntegrationBuild=false /home/REDACTED/work/templating/templating/artifacts/toolset/restore.proj /t:__WriteToolsetLocation /clp:ErrorsOnly;NoSummary /p:__ToolsetLocationOutputFile=/home/REDACTED/work/templating/templating/artifacts/toolset/11.0.0-beta.25527.104.txt(dns block)securitytools.pkgs.visualstudio.com/opt/hostedtoolcache/CodeQL/2.23.1/x64/codeql/csharp/tools/linux64/Semmle.Autobuild.CSharp(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.