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

mono's mscorlib.xml descriptor file seems incomplete for Xamarin.Mac #7716

Closed
dalexsoto opened this issue Mar 20, 2018 · 2 comments · Fixed by #7871
Closed

mono's mscorlib.xml descriptor file seems incomplete for Xamarin.Mac #7716

dalexsoto opened this issue Mar 20, 2018 · 2 comments · Fixed by #7871
Assignees
Labels
area-BCL: mscorlib target-xamarin-mac if shared with iOS use target-xamarin-ios

Comments

@dalexsoto
Copy link
Member

dalexsoto commented Mar 20, 2018

We are trying to remove bundled mscorlib.xml descriptor from mmp and mtouch to only use the mscorlib.xml descriptor file from mono, this is being tracked here: xamarin/xamarin-macios#3772 unfortunately some of our Xamarin.Mac tests are failing once we remove our version of mscorlib.xml bundled in mmp:

From: https://jenkins.mono-project.com/job/xamarin-macios-pr-builder/6741/Test_Report/xammac%20tests_308/execute-Mac-20180319_180538.txt

18:07:41.8031560 Errors and Failures:
18:07:41.8034780 
18:07:41.8037500 1) Encrypt_Empty (MonoTouchFixtures.Security.KeyTest.Encrypt_Empty)
18:07:41.8037940    System.Security.Cryptography.CryptographicException : Input data cannot be coded as a valid certificate.
18:07:41.8038080   ----> System.Security.Cryptography.CryptographicException : Input data cannot be coded as a valid certificate.
18:07:41.8038710   at Mono.Security.X509.X509Certificate.Parse (System.Byte[] data) [0x00322] in <1d8a2c6ac552450b993aa5528b8676fc>:0 
18:07:41.8038820   at Mono.Security.X509.X509Certificate..ctor (System.Byte[] data) [0x00030] in <1d8a2c6ac552450b993aa5528b8676fc>:0 
18:07:41.8038880   at System.Security.Cryptography.X509Certificates.X509Certificate2ImplMono.Import (System.Byte[] rawData, System.String password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags) [0x00041] in <d2bb3d24133342babc3b7359d965b044>:0 
18:07:41.8039330   at System.Security.Cryptography.X509Certificates.X509Helper2.Import (System.Byte[] rawData, System.String password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags, System.Boolean disableProvider) [0x00005] in <d2bb3d24133342babc3b7359d965b044>:0 
18:07:41.8039830   at System.Security.Cryptography.X509Certificates.X509Certificate2.Import (System.Byte[] rawData, System.String password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags) [0x00000] in <d2bb3d24133342babc3b7359d965b044>:0 
18:07:41.8039930   at System.Security.Cryptography.X509Certificates.X509Certificate2..ctor (System.Byte[] rawData, System.String password) [0x00011] in <d2bb3d24133342babc3b7359d965b044>:0 
18:07:41.8039990   at MonoTouchFixtures.Security.KeyTest.get_c () [0x00007] in <67ee688d85c2425e8f705f7ae26e58dc>:0 
18:07:41.8040040   at MonoTouchFixtures.Security.KeyTest.Encrypt_Empty () [0x00006] in <67ee688d85c2425e8f705f7ae26e58dc>:0 
18:07:41.8040100   at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
18:07:41.8040150   at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <ad4283ac8e1d4bce89f5e4cb2d9a5755>:0 
18:07:41.8040200 --CryptographicException
18:07:41.8040260   at Mono.Security.X509.X509Certificate.Parse (System.Byte[] data) [0x0003b] in <1d8a2c6ac552450b993aa5528b8676fc>:0 
18:07:41.8040310 
18:07:41.8040360 
18:07:41.8040410 2) Encrypt_New (MonoTouchFixtures.Security.KeyTest.Encrypt_New)
18:07:41.8040820    System.Security.Cryptography.CryptographicException : Input data cannot be coded as a valid certificate.
18:07:41.8040910   ----> System.Security.Cryptography.CryptographicException : Input data cannot be coded as a valid certificate.
18:07:41.8040970   at Mono.Security.X509.X509Certificate.Parse (System.Byte[] data) [0x00322] in <1d8a2c6ac552450b993aa5528b8676fc>:0 
18:07:41.8041020   at Mono.Security.X509.X509Certificate..ctor (System.Byte[] data) [0x00030] in <1d8a2c6ac552450b993aa5528b8676fc>:0 
18:07:41.8041080   at System.Security.Cryptography.X509Certificates.X509Certificate2ImplMono.Import (System.Byte[] rawData, System.String password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags) [0x00041] in <d2bb3d24133342babc3b7359d965b044>:0 
18:07:41.8041140   at System.Security.Cryptography.X509Certificates.X509Helper2.Import (System.Byte[] rawData, System.String password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags, System.Boolean disableProvider) [0x00005] in <d2bb3d24133342babc3b7359d965b044>:0 
18:07:41.8041560   at System.Security.Cryptography.X509Certificates.X509Certificate2.Import (System.Byte[] rawData, System.String password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags) [0x00000] in <d2bb3d24133342babc3b7359d965b044>:0 
18:07:41.8041680   at System.Security.Cryptography.X509Certificates.X509Certificate2..ctor (System.Byte[] rawData, System.String password) [0x00011] in <d2bb3d24133342babc3b7359d965b044>:0 
18:07:41.8041740   at MonoTouchFixtures.Security.KeyTest.get_c () [0x00007] in <67ee688d85c2425e8f705f7ae26e58dc>:0 
18:07:41.8041790   at MonoTouchFixtures.Security.KeyTest.Encrypt_New () [0x00006] in <67ee688d85c2425e8f705f7ae26e58dc>:0 
18:07:41.8041840   at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
18:07:41.8041900   at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <ad4283ac8e1d4bce89f5e4cb2d9a5755>:0 
18:07:41.8042480 --CryptographicException
18:07:41.8042610   at Mono.Security.X509.X509Certificate.Parse (System.Byte[] data) [0x0003b] in <1d8a2c6ac552450b993aa5528b8676fc>:0 
18:07:41.8042670 
18:07:41.8042720 
18:07:41.8042780 3) Encrypt_Old (MonoTouchFixtures.Security.KeyTest.Encrypt_Old)
18:07:41.8042830    System.Security.Cryptography.CryptographicException : Input data cannot be coded as a valid certificate.
18:07:41.8042880   ----> System.Security.Cryptography.CryptographicException : Input data cannot be coded as a valid certificate.
18:07:41.8042930   at Mono.Security.X509.X509Certificate.Parse (System.Byte[] data) [0x00322] in <1d8a2c6ac552450b993aa5528b8676fc>:0 
18:07:41.8042990   at Mono.Security.X509.X509Certificate..ctor (System.Byte[] data) [0x00030] in <1d8a2c6ac552450b993aa5528b8676fc>:0 
18:07:41.8043040   at System.Security.Cryptography.X509Certificates.X509Certificate2ImplMono.Import (System.Byte[] rawData, System.String password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags) [0x00041] in <d2bb3d24133342babc3b7359d965b044>:0 
18:07:41.8043480   at System.Security.Cryptography.X509Certificates.X509Helper2.Import (System.Byte[] rawData, System.String password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags, System.Boolean disableProvider) [0x00005] in <d2bb3d24133342babc3b7359d965b044>:0 
18:07:41.8043580   at System.Security.Cryptography.X509Certificates.X509Certificate2.Import (System.Byte[] rawData, System.String password, System.Security.Cryptography.X509Certificates.X509KeyStorageFlags keyStorageFlags) [0x00000] in <d2bb3d24133342babc3b7359d965b044>:0 
18:07:41.8043640   at System.Security.Cryptography.X509Certificates.X509Certificate2..ctor (System.Byte[] rawData, System.String password) [0x00011] in <d2bb3d24133342babc3b7359d965b044>:0 
18:07:41.8043690   at MonoTouchFixtures.Security.KeyTest.get_c () [0x00007] in <67ee688d85c2425e8f705f7ae26e58dc>:0 
18:07:41.8043740   at MonoTouchFixtures.Security.KeyTest.Encrypt_Old () [0x00006] in <67ee688d85c2425e8f705f7ae26e58dc>:0 
18:07:41.8043800   at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
18:07:41.8044330   at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <ad4283ac8e1d4bce89f5e4cb2d9a5755>:0 
18:07:41.8044430 --CryptographicException
18:07:41.8044480   at Mono.Security.X509.X509Certificate.Parse (System.Byte[] data) [0x0003b] in <1d8a2c6ac552450b993aa5528b8676fc>:0 

The actual tests that are failing can be found here: https://github.com/xamarin/xamarin-macios/blob/master/tests/monotouch-test/Security/KeyTest.cs#L53-L99

I diff'ed both mscorlib.xml files and narrowed down to the following entries that are missing from mono's mscorlib.xml file:

<!-- exception.c (mono_get_exception_security) -->
<type fullname="System.Security.SecurityException">
    <!-- mono_exception_from_name -->
    <method signature="System.Void .ctor()" />
</type>
<type fullname="System.Security.AllowPartiallyTrustedCallersAttribute" />
<type fullname="System.Security.Policy.Evidence" />
<type fullname="System.Security.SecurityManager" />
<namespace fullname="System.Security.Cryptography" feature="crypto" />

Looks like having <namespace fullname="System.Security.Cryptography" feature="crypto" /> would be the potential solution but not sure if ideal.

Steps to Reproduce

  1. Use Xamarin.Mac from [Linker] Remove bundled mscorlib.xml descriptor from mmp and mtouch xamarin/xamarin-macios#3772 or macios/macios-mac-GHIssue3749 wrench lane pkg
  2. Run Test7716.zip in Release mode.
  3. See failing stack trace in console output

Current Behavior

The following tests fails https://github.com/xamarin/xamarin-macios/blob/master/tests/monotouch-test/Security/KeyTest.cs#L53-L99

Expected Behavior

Tests should pass

On which platforms did you notice this

[ x ] macOS
[ ] Linux
[ ] Windows

Version Used:

Mono JIT compiler version 5.10.0.105 (2017-12/4b1745401d5 Mon Feb 12 18:13:56 EST 2018)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           normal
	SIGSEGV:       altstack
	Notification:  kqueue
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug
	Interpreter:   yes
	LLVM:          yes(3.6.0svn-mono-master/8b1520c8aae)
	GC:            sgen (concurrent by default)
@marek-safar
Copy link
Member

@dalexsoto How do I do Run xammac tests in Release (all optimizations) mode ?

@dalexsoto
Copy link
Member Author

dalexsoto commented Mar 27, 2018

@marek-safar I think this will be easier to reproduce the issue, just run it in Release mode on you will get the exception listed in the description:

Test7716.zip

Steps to Reproduce

  1. Use Xamarin.Mac from [Linker] Remove bundled mscorlib.xml descriptor from mmp and mtouch xamarin/xamarin-macios#3772 or macios/macios-mac-GHIssue3749 wrench lane pkg
  2. Run Test7716.zip in Release mode.
  3. See failing stack trace in console output

akoeplinger pushed a commit that referenced this issue Apr 3, 2018
… net_4_x profile only (#7871)

Fixes #7716

* [corlib] Update linker descriptor with missing types
jonpryor pushed a commit to xamarin/xamarin-android that referenced this issue Oct 9, 2018
Bumps to mono/llvm:release_60@117a508c
Bumps to xamarin/xamarin-android-api-compatibility:master@7ccb4802

	$ git diff --shortstat e1af6ea..ab3c897d       # mono
        1443 files changed, 66049 insertions(+), 45745 deletions(-)
	$ git diff --shortstat bdb3a116..117a508c      # llvm
	 26794 files changed, 4110589 insertions(+), 754376 deletions(-)
	$ git diff --shortstat c550d1bd..7ccb4802      # xamarin-android-api-compatibility
	 2 files changed, 16260 insertions(+), 12347 deletions(-)

Incomplete summary of easily `grep`able fixes:

Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=11199
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=19436
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=23668
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=26983
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=33728
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=46917
fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=60065
Fixes: mono/mono#6173
Fixes: mono/mono#6466
Fixes: mono/mono#6647
Fixes: mono/mono#6834
Fixes: mono/mono#7058
Fixes: mono/mono#7137
Fixes: mono/mono#7260
Fixes: mono/mono#7305
Fixes: mono/mono#7402
Fixes: mono/mono#7525
Fixes: mono/mono#7610
Fixes: mono/mono#7649
Fixes: mono/mono#7655
Fixes: mono/mono#7683
Fixes: mono/mono#7685
Fixes: mono/mono#7716
Fixes: mono/mono#7731
Fixes: mono/mono#7785
Fixes: mono/mono#7828
Fixes: mono/mono#7944
Fixes: mono/mono#7947
Fixes: mono/mono#8036
Fixes: mono/mono#8074
Fixes: mono/mono#8089
Fixes: mono/mono#8112
Fixes: mono/mono#8122
Fixes: mono/mono#8143
Fixes: mono/mono#8149
Fixes: mono/mono#8152
Fixes: mono/mono#8175
Fixes: mono/mono#8177
Fixes: mono/mono#8250
Fixes: mono/mono#8267
Fixes: mono/mono#8273
Fixes: mono/mono#8282
Fixes: mono/mono#8310
Fixes: mono/mono#8311
Fixes: mono/mono#8329
Fixes: mono/mono#8340
Fixes: mono/mono#8372
Fixes: mono/mono#8407
Fixes: mono/mono#8409
Fixes: mono/mono#8422
Fixes: mono/mono#8430
Fixes: mono/mono#8439
fixes: mono/mono#8447
Fixes: mono/mono#8469
Fixes: mono/mono#8504
Fixes: mono/mono#8575
Fixes: mono/mono#8597
Fixes: mono/mono#8623
Fixes: mono/mono#8627
Fixes: mono/mono#8698
Fixes: mono/mono#8701
Fixes: mono/mono#8712
Fixes: mono/mono#8721
Fixes: mono/mono#8726
Fixes: mono/mono#8759
Fixes: mono/mono#8787
Fixes: mono/mono#8820
Fixes: mono/mono#8848
Fixes: mono/mono#8866
Fixes: mono/mono#8897
Fixes: mono/mono#8915
Fixes: mono/mono#8970
Fixes: mono/mono#8979
Fixes: mono/mono#9023
Fixes: mono/mono#9031
Fixes: mono/mono#9033
Fixes: mono/mono#9179
Fixes: mono/mono#9234
Fixes: mono/mono#9262
Fixes: mono/mono#9277
Fixes: mono/mono#9318
Fixes: mono/mono#9542
Fixes: mono/mono#9753
Fixes: mono/mono#9839
Fixes: mono/mono#9869
Fixes: mono/mono#9870
Fixes: mono/mono#9943
Fixes: mono/mono#9996
Fixes: mono/mono#10000
Fixes: mono/mono#10303
Fixes: mono/mono#10447
Fixes: mono/mono#10483
Fixes: mono/mono#10488
Fixes: xamarin/maccore#628
Fixes: xamarin/maccore#673
Fixes: #1561 (comment)
Fixes: #1845
Fixes: xamarin/xamarin-macios#4347
Fixes: xamarin/xamarin-macios#4617
Fixes: xamarin/xamarin-macios#4618
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-BCL: mscorlib target-xamarin-mac if shared with iOS use target-xamarin-ios
Projects
None yet
2 participants