Fixing S.S.Cryptography.Xml tests#16681
Conversation
c4c4521 to
a6f0807
Compare
|
I asked the vendors to make a sweep over the weekend on corefx to change eg |
|
@danmosemsft I have intentionally not marked it as ActiveIssue becuase of https://github.com/dotnet/corefx/issues/16686 which is pretty annoying when working with VS |
81953be to
5b4dddf
Compare
|
@tintoy @anthonylangsworth - I've just made a fix here for some of the yesteday's disabled test |
|
Oh right.. |
|
or not - something is failing on non Windows - I'll take a look later |
|
Sorry @krwq - would love to help out but today's looking like a wash-out, I'm nowhere near my dev machine :-/ Happy to help out again tomorrow though! (it's midday here) |
|
It looks like just escaping issue. Not sure how do you properly escape entity references The path seems to be containing three dashes in a row |
|
I think you can replace it with |
|
Sorry if I was at my dev machine I could try it out but I'm on a low-powered notebook at the moment. |
|
wait - I'm not sure why I used 169 instead of 2D - probably copy paste fail |
|
Yeah I sometimes get it confused with en-dash (the long dash) but that's a bigger value I believe. |
we need some different way of escaping I guess or go to the solution which won't use files... I'm pretty tired of looking at those tiny issues today - I think I'll pass - if any of you would like to take a look please send a PR to my PR or separately. If you got time and will I think it might be a good idea to get a proper solution considering how much time we already spent for the workaround |
|
No worries - I may try expressing it as a |
|
@anthonylangsworth - you're right, I need to clean up my branches on my fork 😉 Thank you for help! |
|
@anthonylangsworth still some tiny failures, likely some slash vs backslash issue considering it only failed on non windows although I haven't investigated. Other option is that XmlPreloadedResolver might have an actual bug (if that's the case it's ok to make a fix but probably separate PR would be a better idea) |
Fix Transform.PropagatedNamespace and test
|
@anthonylangsworth Thank you again! |
…to signed-xml-fixing-tests-1
|
@anthonylangsworth I'll be taking over from where you've left now - Thanks again for another commit! |
Fix for tests failing on Un*x due to "file:///"
|
@anthonylangsworth - Nice, everything green! Good job!!! |
|
@anthonylangsworth @tintoy seems to me like dsaKeyValue.Key.ExportParameters(false); returns object whose Seed is null on linux - I'll investigate it |
|
@anthonylangsworth @tintoy @peterwurzinger let's close on this PR and create a new one. Here are the minimum items we need to re-enable the package: This one requires writing new tests, anything else is bugs after that we can start improving the package. We're almost there! Good job everyone! If you'd like to help on any of them please comment on the issue so we do not accidentally duplicate work. |
| } | ||
|
|
||
| [Fact] | ||
| [Fact(Skip = "https://github.com/dotnet/corefx/issues/16779")] |
There was a problem hiding this comment.
[Fact]
[ActiveIssue(16779)]The commit description said the failure was Linux-only, but this test shows a Windows callstack... If it's actually non-Windows-only, then it'd be [ActiveIssue(16779, PlatformIDs.AnyUnix)]
There was a problem hiding this comment.
@bartonjs I'm not converting to ActiveIssue while there is some active development happening and until this is fixed: https://github.com/dotnet/corefx/issues/16686 - in the issue I meant that the exactly the same test build and run against full .net framework is passing. possibly corefx test is failing when run on desktop or linux is using wrong assemblies - I'll investigate that when I get to this failure. I plan on fixing all of them before publishing the package.
| if (reference != null) | ||
| namespaces = reference._namespaces; | ||
| else if (signedXml._context != null) | ||
| else if (signedXml?._context != null) |
There was a problem hiding this comment.
netfx doesn't ?. here. Is this a netfx bug, or a test bug, that it needs to change?
There was a problem hiding this comment.
@anthonylangsworth, do you remember why it needed to change?
There was a problem hiding this comment.
@anthonylangsworth - I'm looking at the code and possibly this should be Context instead of _context. _context is being set only when someone specifically sets Context but in some cases Context is also set implicitly i.e. through setting Reference
There was a problem hiding this comment.
If the tests found a product bug, but the product bug also exists in .NET Framework, we should leave the bug for now and open a new issue to track it (so that the fix gets marked port-consider and it's obvious what part we're port-considering).
There was a problem hiding this comment.
@anthonylangsworth is this implementing this part correctly now? https://www.w3.org/TR/2001/REC-xml-c14n-20010315#NoNSPrefixRewriting - I'm not sure what PropagatedNamespaces should mean - I do not understand what does "namespace propagated into signature" is supposed to mean but likely it could mean what removed assert was checking: Assert.Equal(new StreamReader(s, Encoding.UTF8).ReadToEnd(), "<f:foo xmlns:f=\"urn:foo\"><b:bar xmlns:b=\"urn:bar\"></b:bar></f:foo>"); - was that implementing C14N-20000119 which is now not recommended? if yes, should we rather expose some new property to follow that so that we don't break existing code?
There was a problem hiding this comment.
@bartonjs @krwq I can confirm netfx also throws a NullReferenceException on the second line below:
// Any class that inherits from Transform will do
System.Security.Cryptography.Xml.XmlDsigC14NTransform transform =
new XmlDsigC14NTransform();
System.Collections.Hashtable x = transform.PropagatedNamespaces;I appear to have found and inadvertently fixed a framework bug. I'll revert this change later today. How do I raise the issue against .Net Framework?
There was a problem hiding this comment.
@anthonylangsworth please keep the change, please file the issue in this repo, assign to me and point to your fix. I'll take care of making sure this gets ported to full .NET I'll do my best at least. I think the test should still be expecting prefixes in the elements though - was this also like that on netfx?
There was a problem hiding this comment.
@krwq I'm pretty sure that our normal tactic here is to always have netfx-impacting changes be as small as possible; so this should stay broken for now, and get fixed as a separate issue.
@AlexGhiondea: Thoughts?
There was a problem hiding this comment.
@krwq since this is a bug in Desktop, here is the process we should follow
- Port the code as-is (don't introduce a change) -- this would bring the code to par with desktop
- File a new issue for the change you are making
- Tag the issue with
netfx-port-considerthis will flag it for consideration for Desktop - Follow the Desktop Shiproom process to get this change approved
If we start making fixes as we are porting the code there is a high chance that we are going to forget to port that change back to Desktop.
| s.Position = 0; | ||
|
|
||
| HashAlgorithm hash = HashAlgorithm.Create("System.Security.Cryptography.SHA1CryptoServiceProvider"); | ||
| HashAlgorithm hash = SHA1.Create(); |
There was a problem hiding this comment.
HashAlgorithm : IDisposable, this should be in a using.
| transform.LoadInnerXml(doc.ChildNodes); | ||
| Stream s = (Stream)transform.GetOutput(); | ||
| Assert.Throws<ArgumentNullException>(() => Stream2Array(s)); | ||
| Assert.Throws<ArgumentNullException>(() => |
There was a problem hiding this comment.
What's supposed to ANE here? If it's checking that transform.GetOutput() is null then assert that it's null...
There was a problem hiding this comment.
@bartonjs we are porting existing Mono tests right now and simply fixing errors happened during conversion from different test framework. I agree this is not ideal but I think we should do separate pass on these kind of clean ups
There was a problem hiding this comment.
@krwq I appreciate that. But my point is that if you're making a change to the test you should make the right change. It seems weird to me to have a two line lambda expecting an ArgumentNullException. If the problem is that Mono and NetFx generate them from different places, add a comment. Otherwise, make the test test what we want it to test.... whatever that may be.
|
@anthonylangsworth I have disabled the test, left the change to the test and reverted the |
|
@bartonjs - I've changed SHA1 to be wrapped with using, changed ArgumentNullException test to have 1 line lambda and undid change introducing diff with Desktop |
|
Thank you everyone for help here! |
…sts-1 Fixing S.S.Cryptography.Xml tests Commit migrated from dotnet/corefx@718d569
cc @anthonylangsworth @tintoy @peterwurzinger