-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Adds support for fields and null values #2
Conversation
Add files via upload
Hi @skigrinder, I'm nanoFramework bot. A human will be reviewing it shortly. 😉 |
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.
Please see the comments. Also, why have you created a new project and not used the sample one?
@@ -55,7 +55,7 @@ public static void Main() | |||
|
|||
DoArrayTest(); | |||
DoSimpleObjectTest(); | |||
DoFloatNaNObjectTest(); | |||
//DoFloatNaNObjectTest(); |
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.
Lets keep the test, even if it fails, so that people can see...
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.
Agreed.
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.
Didn't you create the Json.Test project?
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.
Sorry, the json nfproj seems to be totally recreated in your PR (not the test one)... not sure why that is...
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.
I think it probably has to do with the nerdbank NuGet. I had updated to the latest beta version and didn't realized this would cause problems. I tried to revert back to the stable version and things got really messed up.
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.
Figured out the issues with Json.Test - it now builds
@@ -13,7 +16,7 @@ internal static class DebugHelper | |||
// Used this a lot in the effort to get Array serialization & deserialization working | |||
public static void DisplayDebug(string displayString) | |||
{ | |||
#if DEBUG | |||
#if NANOFRAMEWORK_DISPLAY_DEBUG |
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.
nanoFramework will automatically show the Console.WriteLine
when #if DEBUG is used and the lib is in debug mode, there is no reason for NANOFRAMEWORK_DISPLAY_DEBUG here. Please revert. (note, it is now preferable to use Debug.WriteLine
which removes the need for this function entirely)
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.
I thought about changing everything to Debug.WriteLine, but there's a lot of output.
Don't most people work in Debug mode?
If so, the serialize/deserialize output would be annoying.
I thought NANOFRAMEWORK_DISPLAY_DEBUG would be a convenient way to turn on the lib output if we ever need to work on it again.
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.
Not sure how Debug works when referencing published nugets… @josesimoes will Debug be output when published and referenced?
{ | ||
dt = DateTimeExtensions.FromASPNetAjax(sdt); | ||
} | ||
else | ||
} |
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.
Please try and remove any whitespace changes, they make reviewing a lot harder
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.
Sorry, this was an attempt to conform to the coding standard.
@@ -397,15 +464,15 @@ private static JsonToken Deserialize() | |||
throw new Exception("unexpected lexical token during json parse"); | |||
} | |||
return result; | |||
} | |||
} // end of Deserialize() |
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.
No need for comments like this, as VS can easily shrink functions and this does not conform to the C# nF code style
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.
OK
@@ -464,7 +531,7 @@ private static JsonArrayAttribute ParseArray(ref LexToken token) | |||
} | |||
var result = new JsonArrayAttribute((JsonToken[])list.ToArray(typeof(JsonToken))); | |||
return result; | |||
} | |||
} // end of ParseArray() |
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.
No need for comments like this, as VS can easily shrink functions and this does not conform to the C# nF code style
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.
OK
@@ -520,7 +587,7 @@ private static JsonToken ParseValue(ref LexToken token) | |||
} | |||
|
|||
throw new Exception("invalid value found during json parse"); | |||
} | |||
} // end of ParseValue() |
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.
No need for comments like this, as VS can easily shrink functions and this does not conform to the C# nF code style
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.
OK
@@ -72,11 +77,11 @@ | |||
<ProjectConfigurationsDeclaredAsItems /> | |||
</ProjectCapabilities> | |||
</ProjectExtensions> | |||
<Import Project="..\packages\Nerdbank.GitVersioning.3.1.91\build\Nerdbank.GitVersioning.targets" Condition="Exists('..\packages\Nerdbank.GitVersioning.3.1.91\build\Nerdbank.GitVersioning.targets')" /> | |||
<Import Project="..\packages\Nerdbank.GitVersioning.3.2.5-beta\build\Nerdbank.GitVersioning.targets" Condition="Exists('..\packages\Nerdbank.GitVersioning.3.2.5-beta\build\Nerdbank.GitVersioning.targets')" /> |
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.
Please dont update this nuget, we need the stable one for the release pipeline
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.
Interesting. This created some trouble for me. I'll revert back to 3.1.91
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> | ||
<PropertyGroup> | ||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.The missing file is {0}.</ErrorText> | ||
</PropertyGroup> | ||
<Error Condition="!Exists('..\packages\Nerdbank.GitVersioning.3.1.91\build\Nerdbank.GitVersioning.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Nerdbank.GitVersioning.3.1.91\build\Nerdbank.GitVersioning.targets'))" /> | ||
<Error Condition="!Exists('..\packages\Nerdbank.GitVersioning.3.2.5-beta\build\Nerdbank.GitVersioning.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Nerdbank.GitVersioning.3.2.5-beta\build\Nerdbank.GitVersioning.targets'))" /> |
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.
Please dont update this nuget, we need the stable one for the release pipeline
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.
OK
<package id="nanoFramework.System.Collections" version="1.0.1-preview.6" targetFramework="netnanoframework10" /> | ||
<package id="nanoFramework.System.Text" version="1.0.0-preview.16" targetFramework="netnanoframework10" /> | ||
<package id="nanoFramework.Windows.Storage.Streams" version="1.8.2-preview.5" targetFramework="netnanoframework10" /> | ||
<package id="Nerdbank.GitVersioning" version="3.1.91" targetFramework="netnanoframework10" developmentDependency="true" /> | ||
<package id="Nerdbank.GitVersioning" version="3.2.5-beta" targetFramework="netnanoframework10" developmentDependency="true" /> |
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.
Please dont update this nuget, we need the stable one for the release pipeline
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.
OK
else if (memberProperty.Value is JsonValue) | ||
{ | ||
// Don't need any more info - populate the member using memberSetMethod.Invoke() | ||
DebugHelper.DisplayDebug($"{debugIndent} memberProperty.Value is JValue"); | ||
if (memberType != typeof(DateTime)) | ||
if (memberType != typeof(DateTime)) |
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.
Extra space?!
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.
Removed
{ | ||
DateTime dt; | ||
var sdt = ((JsonValue)memberProperty.Value).Value.ToString(); | ||
if (sdt.Contains("Date(")) | ||
if (sdt.Contains("Date(")) |
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.
Extra space?!
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.
Removed
} | ||
} | ||
} |
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.
Extra space?!
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.
Removed
@@ -436,13 +503,13 @@ private static JsonObjectAttribute ParseObject(ref LexToken token) | |||
throw new Exception("unterminated json object"); | |||
} | |||
return result; | |||
} | |||
} // end of ParseObject() |
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.
Remove comment
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.
Removed
@skigrinder , keep pushing to your branch, the changes will make the comments outdated (due to your changes) so that we are automatically aware... |
Fixes some style issues Reverts debug def (as not important for most users)
@skigrinder , I hope you dont mind, but I have cleaned up the rest of the remaining issues... I just need to test it now, and then it can be committed. Hopefully the commits I have made will help you with future PR's. The main (remaining) issue was that you had created seperate solutions for each project, when you should have just opened the existing one... |
In regards to the debug helper, (as confirmed by @josesimoes (in private cononversation)) nugets are only published as "release", so it is wise not to use a custom debug def... |
@networkfusion, thanks for the effort. Glad to know that the NuGets are all built as 'Release'. |
@skigrinder not to worry, it didn't take long to do the last little bits, and we are glad for the contribution. plus, you enjoy the fact that the PR was of your making... Yes, feel free to convert to |
Hi Robin,
Will my existing fork eventually get rolled in and disappear?
If so, I don't want to cause confusion by creating another fork (or is
that OK?).
Please let me know.
Thanks,
Jim
…On 2020-05-25 3:08 PM, Robin Jones wrote:
@skigrinder <https://github.com/skigrinder> not to worry, it didn't
take long to do the last little bits, and we are glad for the
contribution. plus, you enjoy the fact that the PR was of your
making... Yes, feel free to convert to |Debug.WriteLine| in another PR
(using another branch).
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AO2PVOMJHO3QB4MAROCNGELRTLM35ANCNFSM4NDM3NWQ>.
|
Since you didn't use a different branch, you will need to do something like https://ardalis.com/syncing-a-fork-of-a-github-repository-with-upstream (although on the |
Hi Robin,
I blew away my original fork and created a new one.
This created a new copy of the current lib in a new repository on my GitHub.
In my new repository, I created a new branch - "skigrinder - use
Debug.WriteLine()"
I tried to create a new branch in the nanoFramework repository but it
wouldn't let me.
Doesn't this need to be done?
I don't want to go any further for fear of making the same mistake as
last time.
I've done a lot of googling and it seems like there should be a new
branch on the nanoFramework repository before I start making & commiting
changes (but I can't create one).
Or, will a new branch get created on the nanoFramework repository when I
do the PR?
Please let me know if I'm on the right path or if I should clobber my
new fork and start over.
Thanks,
Jim
…On 2020-05-25 3:44 PM, Robin Jones wrote:
Since you didn't use a different branch, you will need to do something
like
https://ardalis.com/syncing-a-fork-of-a-github-repository-with-upstream
(although on the |develop| branch instead of |master|. The
althernative is to "delete" your fork and start again (it will cause
no issues now that this PR is closed). I have done both in the past...
But for next time, make sure you create a new branch when making
changes in your own fork, and then you can just switch to |develop|
pull the changes and merge onto your new branch whenever nF changes...
there is lots of info out there, just google it...
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AO2PVOP4LCJI2ZFQ4MT5TQ3RTLRCDANCNFSM4NDM3NWQ>.
|
You need to create the branch in your fork. The branch will be available to nF when a PR is raised. At that point, the branch will be merged into this repos develop branch... |
Got it & thanks!
I was hoping that's how it works but wanted to make sure.
Thanks,
Jim
…On 2020-05-25 9:51 PM, Robin Jones wrote:
You need to create the branch in your fork. The branch will be
available to nF when a PR is raised. At that point, the branch will be
merged into this repos develop branch...
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AO2PVOLK3XDXNQMUPCIUFXDRTM4D5ANCNFSM4NDM3NWQ>.
|
Hi Robin,
Just finished making the Debug.WriteLine() changes had have done a PR.
Please let me know if you can see it and if I need to do anything more.
Thanks again for all your help.
Every time I do this it gets a little easier.
Thanks,
Jim
…On 2020-05-25 9:51 PM, Robin Jones wrote:
You need to create the branch in your fork. The branch will be
available to nF when a PR is raised. At that point, the branch will be
merged into this repos develop branch...
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AO2PVOLK3XDXNQMUPCIUFXDRTM4D5ANCNFSM4NDM3NWQ>.
|
Adds support for fields and null values which fail in the test application
Motivation and Context
Required to ensure serialization and deserialization work correctly.
How Has This Been Tested?
Against the included test program.
Types of changes
Checklist: