Forum Xamarin.iOS

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Is InternalsVisibleTo available to allow MonoTouch Unit Tests access to the internal of a MT Lib?

Can you use the InternalsVisibleTo assembly attribute in a AssemblyInfo file of a MonoTouch Library to allow MonoTouch Unit Test (Touch.Unit) access to the internals of the MonoTouch library?

This is something that is great to use in non-MonoTouch world to allow testing of internals without having to jump through hoops. However I am not able to get it working with a MonoTouch Unit Test. So before I go any futher I figured I would ask if it is even possible, since this is an iOS Application that is the test runner, so not sure if an iOS application which is compiled to native code can even do this.

Best Answer

Answers

  • RodneyFoleyRodneyFoley USBeta ✭✭

    I have attached a MonoDevelop solution with a MT Library and a MT Unit Test that reproduces the problem I am having. If you compile the solution you will get this error:

    Error CS0281: Friend access was granted to 'MonoTouchUnitTests, PublicKeyToken=47ed45b5687d5373', but the output assembly is named 'MonoTouchUnitTests, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. Try adding a reference to 'MonoTouchUnitTests, PublicKeyToken=47ed45b5687d5373' or change the output assembly name to match it (CS0281) (MonoTouchUnitTests)

  • RodneyFoleyRodneyFoley USBeta ✭✭

    Bug 9156 Created

  • RodneyFoleyRodneyFoley USBeta ✭✭

    No Problem Sebastien, thanks for the workaround.

  • RodneyFoleyRodneyFoley USBeta ✭✭

    @poupou, sorry to report but the workaround sort of works but sort of doesn't work. It now gives a new error stating that "monotouch" is not a strong named assembly. That is shocking, I would have assumed that your core DLL is signed and strong named, otherwise no one who has a monotouch library or app can strong name their stuff because of this dependency.

    I updated the bug, but seems like a much much much bigger issue if you are release monotouch without signing or strong naming. If you are then you have a huge bug where MD can't see it.

Sign In or Register to comment.