xunit / devices.xunit

xUnit.net Runners for Devices
Other
73 stars 36 forks source link

xunit.runner.utility required dependency not included in app build #5

Closed goodlaff closed 9 years ago

goodlaff commented 9 years ago

When running the app an error occurs stating that it cannot find xunit.runner.utility.dll to load, and inspecting the app/apk output you can see it is indeed not bundled (implicit linked assemblies are optimised out)

To get around this you can manually include the xunit.runner.utility package from nuget in the project.

Better solution to ensure that mono bundles this assembly in the app would be to add the xunit.runner.utility nugget package as a dependency to xunit.runner.xamarin and not a file reference:

NOTE: this happens even if you include the following line in the appdelegate or mainactivity classes: AddExecutionAssembly(typeof(ExtensibilityPointFactory).Assembly);

clairernovotny commented 9 years ago

Looping in @bradwilson - was there a reason why the runner apps shouldn't reference runner.utility directly again. I'm trying to remember why it's in the \build dir here https://github.com/xunit/xamarin.xunit/blob/master/src/xunit.runner.xamarin.nuspec instead of adding it as a dependent package

clairernovotny commented 9 years ago

Hi Keith,

I just was trying to repro this issue but when I looked at the APK, I did see the xunit.runner.utility.dll inside it?

I created a new blank Xamarin.Android project and added the xunit.xamarin nuget to it. I then built it & created a package from it. Looking at the apk, I see it inside.

What version of Xamarin are you using? FWIW, I'm using the latest beta, 3.9.221. Can you try again with that version and let me know your results?

Thanks

clairernovotny commented 9 years ago

Please let me know the xam version and see if this version works for you 0.99.6. Just follow the steps in this gist to add the CI Nuget feed. https://gist.github.com/onovotny/76d6c6ed83ab15ea3e8d

This should fix the autostart/terminate issues, but I haven't touched the android runner as I haven't seen that issue yet with my xamarin version.

goodlaff commented 9 years ago

Hi @onovotny ,

Sorry, I've been really busy the last few days so only getting around to this now.

Firstly, added the new 0.99.6 runners to my existing project and the AutoStart and Terminate functionality works for both iOS and Android as expected, thanks!

(tested on OSX 10.10.1; XCode 6.1.1; XS 5.5.4.15; X.iOS 8.4.0.47; X.Android 4.20.0.28)

Secondly, created a new xf shared project and added new 0.99.6 runners, compiled and ran. The android app ran with no problems, however the iOS app is still returning the System.IO.FileNotFoundException on startup with message:

"Could not load file or assembly 'xunit.runner.utility, Version=2.0.0.2785, Culture=neutral, PublicKeyToken=null' or one of its dependencies."

Checking the app package contents I can see the xunit.runner.utility is not bundled.

Have just tried with latest beta (XS 5.7.0.660; X.iOS 8.6.0.41; X.Android 4.20.0.28) with same results - Android OK, iOS error.

To confirm, if I explicitly add the xunit.runner.utility package to the iOS project then it runs perfectly.

clairernovotny commented 9 years ago

Ah, I thought you were having trouble with the Android version. Nevertheless, I've changed up the nuspec a bit to add that dependency. From what I recall, the issue is more around WP8 where we can't have the runner utility directly referenced if we also want to use the VS Runner. I've left the msbuild magic there where it seems to be okay.

Can you please check the latest build 0.99.6-build1035 or 1036 and let me know if that works for you. I tested it on my iPad and it ran tests fine. I was having trouble with the simulator though but that could just be my VM/Mac.

Thanks!

clairernovotny commented 9 years ago

I've pushed this version to the main NuGet as 0.99.6-beta5. Please confirm that this fixes both your Android and iOS issues?

Thanks!

goodlaff commented 9 years ago

Hi @onovotny,

Sorry, been away for the last 2 weeks.

Have checked the latest build from nuget and it works perfectly on iOS and Android with no need to explicitly include utility package.

Thanks for sorting this out!

Keith