Skip to content

Storing DateTime in local app settings causes exception #1959

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

Closed
dpaulino opened this issue Sep 28, 2019 — with docs.microsoft.com · 4 comments
Closed

Storing DateTime in local app settings causes exception #1959

dpaulino opened this issue Sep 28, 2019 — with docs.microsoft.com · 4 comments
Assignees
Labels
doc-enhancement feedback is about suggested additions/improvements to the article, but customer is not blocked eng-triaged

Comments

Copy link
Contributor

According to this section, I should be able to store DateTime in the local app settings. However, when I try to run the following code, I get an exception.

Windows.Storage.ApplicationData.Current.LocalSettings.Values["test"] = DateTime.Now;

Am I doing something wrong? Is there an issue with the document? Or is there a bug in the platform?


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@dpaulino
Copy link
Contributor Author

Here is a screen shot of a blank UWP app with that line of code added in the MainPage.xaml.cs constructor

image

@dpaulino
Copy link
Contributor Author

Here is a repository that you can clone and you can reproduce the error:
https://github.com/dpaulino/datetime-local-appsettings-uwp/tree/master/LocalAppSettings

@hkhmsft hkhmsft added the support-request A support-style question where the customer needs help solving a problem. label Sep 30, 2019
@dpaulino
Copy link
Contributor Author

Figured out what went wrong. I created this PR to help improve the docs #1971

@jwmsft jwmsft assigned jwmsft and unassigned mijacobs Oct 17, 2019
@jwmsft jwmsft added doc-enhancement feedback is about suggested additions/improvements to the article, but customer is not blocked and removed support-request A support-style question where the customer needs help solving a problem. labels Oct 17, 2019
@jwmsft
Copy link
Contributor

jwmsft commented Oct 21, 2019

@dpaulino, thanks for the PR. DateTime is tricky because it shows up differently depending on the language you're programming in, so I also added a note that DateTimeOffset is for C# and .NET languages.

@jwmsft jwmsft closed this as completed Oct 21, 2019
QuinnRadich pushed a commit that referenced this issue Oct 19, 2021
* test

test

* Update toc.yml

* Update toc.yml

* Update benefits.md

* test

* Fixed a typo.

* Update dwritecore.md

* Update dwritecore.md

* Create PhotoLabConversion.zip

* first draft of cppwinrt case study (#1826)

* first draft of cppwinrt case study

* fixing suggestions

* Update case-study-1.md

* some edits to the case studies (#1840)

* some edits to the case studies

* couple more tweaks

* adding alternative folder names (#1850)

* move files into new folders (#1852)

* updating TOC (#1853)

* some review changes (#1854)

* some refactoring (#1856)

* some refactoring

* more updates

* just fixing TOC (#1857)

* more refactoring (#1861)

* more refactoring and new items (#1864)

* adding more content (#1868)

* Stwhi uwp migration/adding items 4 (#1871)

* cppwinrt-only section

* more items

* more items/updates, and port -> migrate (#1874)

* more items/updates, and port -> migrate

* correcting build issues

* correcting build issues 2

* correcting build issues 3

* correcting build issues 4

* last updates for the week (#1877)

* more edits, additions, etc. (#1884)

* more edits, additions, etc.

* fixing url

* more items (#1889)

* UWP migration updates (aleader) (#1890)

* A few fixups

* Added some feature table mappings

* More content

* Merge

* Update what-is-supported.md

* another item (#1892)

* another round of updates (#1893)

* renaming Migration guide titles (#1894)

* more items (#1895)

* more items

* fixing build suggestions

* fixing build suggestion

* more items (#1896)

* last of the new items for the time being (#1900)

* last of the new items for the time being

* fixing build issues

* experimenting with anchors

* fixing build issue

* Add

* Create uwp-migration-msal-graph.md

* Update feature-mapping-table.md

* Minor UWP migration updates (#1904)

* Updates to what is supported

* Update what-is-supported.md

* Update what-is-supported.md

* Update api-mapping-table.md

* Update overall-migration-strategy.md

* Update case-study-1.md

* Update

* Update case-study-1.md

* Update case-study-1.md

* Update case-study-1.md

* Update case-study-1.md

* Acrylic brush item (#1919)

* first half of copy-editing (#1924)

* Update mrtcore.md

* Update feature-mapping-table.md

* Stwhi uwp migration/adding items 17 (#1927)

* edit passes, improvements, etc.

* build issues

* copy-editing and rewriting (#1935)

* Update feature-mapping-table.md

* Adding warning for D2D support

* Adding brief sentence for DWriteCore value prop

* Update uwp-migration-msal-graph.md

* Add and Edit

Adding notifcations.md and changes to applifecycle.md

* actioning feedback (#1952)

* copy-editing (#1957)

* copy-editing

* assigning topics to myself

* more updates as per email (#1959)

* more entries to the API mapping table (#1964)

* more entries to the API mapping table

* build warnings

* index (#1965)

* Update case-study-1.md

* Adding line for Win2D to feature mapping table

* Add TaskbarManager to unsupported APIs

* Fix absolute link

* Update overall-migration-strategy.md

* windowing guide (#1976)

* windowing topic complete for now (#1978)

* working around table rendering issues (#1979)

* removed retry value. Added HTTP post example (#1980)

* removed retry value. Added HTTP post example

* fixed wording on retries

* updating API mappings (#1982)

* updating API mappings

* fixing table

* Delete uwp-migration-msal-graph.md

Co-authored-by: Bhavya Gursahani <[email protected]>
Co-authored-by: Mike Battista <[email protected]>
Co-authored-by: Bhavya Gursahani <[email protected]>
Co-authored-by: McLean Schofield <[email protected]>
Co-authored-by: Andrew Leader <[email protected]>
Co-authored-by: AdamBrMSFT <[email protected]>
Co-authored-by: Duncan MacMichael <[email protected]>
Co-authored-by: Nicu Parente <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-enhancement feedback is about suggested additions/improvements to the article, but customer is not blocked eng-triaged
Projects
None yet
Development

No branches or pull requests

5 participants