Skip to content
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

Several UnitTestParseTests.Parse are failing #709

Closed
josesimoes opened this issue Mar 4, 2021 · 3 comments
Closed

Several UnitTestParseTests.Parse are failing #709

josesimoes opened this issue Mar 4, 2021 · 3 comments

Comments

@josesimoes
Copy link
Member

Details about Problem

nanoFramework area: (mscorlib )

Detailed repro steps so we can see the same problem

Several Parse calls are failing. The all code section needs to be reviewed. Evaluate if this is better fixed at managed or native end. OK to move to native if more efficient.

Screenshot

image

@edleno2
Copy link

edleno2 commented May 25, 2021

@josesimoes - so in one of the cases the problem is that the native code isn't generating an exception - so something like Byte.Parse("") gets a FormatException in .net Core. So for practice I added the code to nanoCLR and CoreLibrary to add System.FormatException and I got it all to work. Wanted to understand really how the checksums and c#->C++ interop work. Is it Ok if I check that in? It does mean new versions of firmware go to with a new version of CoreLibrary that wasn't really necessary. But maybe better for me to learn how on something small like this - but, may break the build if I don't get everything right. I think I have to manually change the version in corlib_native.cpp to the next version. Do I also bump the version in version.json in CoreLibrary - the preview number will bump anyhow. Will the build process update the message in Nuget about the required framework version or is that a manual process?

@josesimoes
Copy link
Member Author

@josesimoes - so in one of the cases the problem is that the native code isn't generating an exception - so something like Byte.Parse("") gets a FormatException in .net Core.

Understood and that makes sense.

So for practice I added the code to nanoCLR and CoreLibrary to add System.FormatException and I got it all to work. Wanted to understand really how the checksums and c#->C++ interop work. Is it Ok if I check that in? It does mean new versions of firmware go to with a new version of CoreLibrary that wasn't really necessary.

If I understood this correctly, it's a matter of throwing that exception right from the C# code. No need to change anything at the native end.

But maybe better for me to learn how on something small like this - but, may break the build if I don't get everything right. I think I have to manually change the version in corlib_native.cpp to the next version. Do I also bump the version in version.json in CoreLibrary - the preview number will bump anyhow. Will the build process update the message in Nuget about the required framework version or is that a manual process?

That's basically it. 1) you make the changes 2) bump assembly native version (if anything is changing in the API) 3) generate the stubs 4) update the declaration of the CorLib in native 5) adjust whatever is required there.
All the rest is automated.

@josesimoes
Copy link
Member Author

Fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants