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

[libraries][iOS][tvOS] Fix case of assembly in ActivatorTests #57237

Merged

Conversation

mdh1418
Copy link
Member

@mdh1418 mdh1418 commented Aug 11, 2021

Part of #52072
Part of #34030

TestingCreateInstanceFromObjectHandleFullSignature and TestingCreateInstanceFromObjectHandle fail on iOS and tvOS with the following error

System.Tests.ActivatorTests.TestingCreateInstanceFromObjectHandleFullSignature(physicalFileName: \"TestLoadAssembly.dll\", assemblyFile: \"testloadassembly.dll\", type: \"publicclasssample\", ignoreCase: True, bindingAttr: Instance | Public, binder: DefaultBinder { }, args: [], culture: , activationAttributes: null, returnedFullNameType: \"PublicClassSample\")
    System.IO.FileNotFoundException : Could not load file or assembly '/Users/mdhwang/Library/Developer/CoreSimulator/Devices/71D00C72-A1BD-4EF7-87EA-B22842EC1650/data/Containers/Bundle/Application/81C73384-2A96-498B-B352-4F61452336F8/System.Runtime.Tests.app/testloadassembly.dll' or one of its dependencies.
       at System.Runtime.Loader.AssemblyLoadContext.InternalLoadFromPath(String assemblyPath, String nativeImagePath)
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath)
   at System.Reflection.Assembly.LoadFrom(String assemblyFile)
   at System.Activator.CreateInstanceFrom(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
   at System.Tests.ActivatorTests.TestingCreateInstanceFromObjectHandleFullSignature(String physicalFileName, String assemblyFile, String type, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, String returnedFullNameType)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

System.IO.FileNotFoundException is hit in https://docs.microsoft.com/en-us/dotnet/api/system.activator.createinstancefrom?view=net-5.0 as a result of the assembly file not found.
Looking at the memberdata, the test with TestLoadAssembly.dll works, whereas testloadassembly.dll leads to the wrong exception.
Looking at the expected throw, TypeLoadException requires that just the typename not be found within the assembly, so changing the case of the assembly file is not necessary.

This PR looks to modify the test data to remove the physicalFileName parameter and to have the correctly typed assembly file, and by doing so, the tests pass on iOS and tvOS.

@mdh1418 mdh1418 added this to the 6.0.0 milestone Aug 11, 2021
@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

@mdh1418 mdh1418 force-pushed the iOS_tvOS_fix_Activator_Tests_case_sensitive branch from fbe3610 to c84e1a7 Compare August 12, 2021 16:15
@mdh1418 mdh1418 force-pushed the iOS_tvOS_fix_Activator_Tests_case_sensitive branch from b3a3085 to c84e1a7 Compare August 12, 2021 16:38
@mdh1418
Copy link
Member Author

mdh1418 commented Aug 12, 2021

It looks like #36896 and the rest of #34030 in AppDomainTests has a similar casing issue that had been partially resolved by #56586.
Ill have a follow up PR that will address the AppDomainTests separately and close #34030 there.

@mdh1418 mdh1418 merged commit 41e93d4 into dotnet:main Aug 12, 2021
@mdh1418 mdh1418 deleted the iOS_tvOS_fix_Activator_Tests_case_sensitive branch August 12, 2021 20:16
@ghost ghost locked as resolved and limited conversation to collaborators Sep 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants