Forum Visual Studio

LiveReload runtime exception on initialisation

Hi all,

I'm trying to get LiveReload running but I get the following runtime error:

System.TypeLoadException: VTable setup of type Xamarin.Live.CommandBus failed

on the call to LiveReload.init().

Any suggestions?

Thanks,
Tom.

Best Answer

Answers

  • ThomasEveringhamThomasEveringham USMember ✭✭

    Noticed this in stack trace:

    "no implementation for interface method Merq.ICommandBus::add_CommandStarted(EventHandler`1) in class Xamarin.Live.CommandBus"

    Visual Studio 2017 v15.7.1
    Tried emulator and physical device, same exception

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    VS2017 v15.7.2
    Same error trying to get LiveReload going

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    @ThomasEveringham
    Try uninstalling the MSBUild.Sdk.Extras nuget
    Once I took these 3 OUT it will build again.
    It doesn't work and I have my doubts about any Xmararin previewer because I'm jaded by none of them ever being any good - but at least it doesn't crash now.

  • kzukzu USXamarin Team, Insider Xamurai

    Hey guys, sorry for the confusion. As noted in the instructions, you should only be installing the Xamarin.LiveReload package.

    Does it still fail for you @ThomasEveringham when that is the only installed package?

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    @kzu said:
    Hey guys, sorry for the confusion. As noted in the instructions, you should only be installing the Xamarin.LiveReload package.

    Does it still fail for you @ThomasEveringham when that is the only installed package?

    The mqtt.server package is needed or i get an error of reference to it not found during compile.
    I can't speak for Thomas, but the compile/deploy doesn't crash - but it doesn't actually LiveReload either. IE: Updates made to the XAML don't update the deployed app in real-time/runtime.

  • ThomasEveringhamThomasEveringham USMember ✭✭

    Hi guys, thanks for the responses. @kzu it was still failing but I had not been using PackageReferences. I've now migrated and that solved my problems. And you're right, the original issue was due to installation of additional packages. Works like a charm! What a time saver.

    Notes for others:

    1) The error I was getting before migrating to PackageReferences, with only the LiveReload package installed, was:

    Unable to resolve dependency 'System.Net.Mgtt' ...

    Migrating to PackageReferences as described by kzu fixed this.


    2) After migrating to PackageReferences I was getting the following error (despite having tried restore packages):

    This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is...

    To fix this I had to remove the following section from the .csproj file, which I think was only relevant pre-PackageReferences migration:

    <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
        <PropertyGroup>
          <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
        </PropertyGroup>
        <Error Condition="!Exists('..\..\packages\Xamarin.Forms.3.0.0.482510\build\netstandard1.0\Xamarin.Forms.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.Forms.3.0.0.482510\build\netstandard1.0\Xamarin.Forms.props'))" />
      </Target>
    

    3) The last (unrelated) error I got was mismatch between NuGet package version and VS extension version:

    The current project references Xamarin.LiveReload NuGet package version '0.3.27' but the Xamarin Live Reload extension requires '0.4.0'.

    The extension had at some point updated to 0.4.0, which doesn't appear to be currently released. I uninstall/re-installed the extension and then the 0.3.27 package worked without any problems.

  • kzukzu USXamarin Team, Insider Xamurai
    Thanks @ThomasEveringham for the detailed report! I'm glad it's working now. We're planning on streamlining the installation so this doesn't happen. Thanks for your patience!
  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    @kzu said:

    The mqtt.server package is needed or i get an error of reference to it not found during compile.

    That means you're likely not using PackageReferences. I strongly suggest you migrate to that using the context-menu over the packages.config.

    Do you ever get the "Device connected" message in the IDE infobar?

    I had no idea about this new PackageReferences scheme. Impossible to keep up on everything I guess. But as much as a troll the forum I would have thought there would have been more of an announcement about it. Or a reference on the LiveReload page saying it was a requirement.
    I did find this article detailing how to do the upgrade - for the next person stuck in the same boat.
    https://blog.nuget.org/20180409/migrate-packages-config-to-package-reference.html

    However I'm stuck when trying to build because it gives me a System.Memory.dll not found when compiling. Researching that shows all sorts of other people that had the same thing starting around January of this year. I see several hacks for it. I would like to believe that in the last 6 months a more refined solution exists. Any ideas? I've tried removing System.Memory and re-adding now that I've migrated to PackageReferences per that article - but no joy.

  • PierceBogganPierceBoggan USForum Administrator, Xamarin Team, Developer Group Leader Xamurai
    edited June 2018

    @ClintStLaurent PackageReference is pretty nifty; it gets rid of lots of the problems folks have with NuGet, especially around dependency resolution, which is why our templates moved to it back in November.

    PackageReference isn't a requirement of Live Reload, it just increases the likelihood that NuGet will properly restore dependencies, as was the problem here. That being said, many projects are still using packages.config, and we definitely don't want to enforce it as a requirement for Live Reload. We're working on making sure it's a smooth experience for both PackageReference and packages.config.

    This preview period is great for bubbling up issues like this. We definitely are listening to your feedback and making sure Live Reload is the best it can be.

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    @PierceBoggan
    Thanks for the reply. Since LiveReload doesn't seem to work for me and the migration worked for someone else I thought I would give it a shot. At this point I can only consider LiveReload as 'not yet working' and PackagesReferences as not having all the bugs shaken out yet (at least until it doesn't vomit over System.Memory.dll)

    LiveReload is preview - so it being broken is part and parcel with ongoing development. No harm, no foul.

  • PierceBogganPierceBoggan USForum Administrator, Xamarin Team, Developer Group Leader Xamurai

    @ClintStLaurent Awesome! Happy to follow up over email with any feedback on Live Reload. [email protected] is the best way to get in touch! :)

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    @PierceBoggan said:
    @ClintStLaurent Awesome! Happy to follow up over email with any feedback on Live Reload. [email protected] is the best way to get in touch! :)

    Thanks for that. But as it doesn't work I don't think I can offer much feedback.

  • PierceBogganPierceBoggan USForum Administrator, Xamarin Team, Developer Group Leader Xamurai

    @ClintStLaurent said:

    @PierceBoggan said:
    @ClintStLaurent Awesome! Happy to follow up over email with any feedback on Live Reload. [email protected] is the best way to get in touch! :)

    Thanks for that. But as it doesn't work I don't think I can offer much feedback.

    I want to help figure out why it doesn't work!

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    @PierceBoggan said:

    @ClintStLaurent said:

    @PierceBoggan said:
    @ClintStLaurent Awesome! Happy to follow up over email with any feedback on Live Reload. [email protected] is the best way to get in touch! :)

    Thanks for that. But as it doesn't work I don't think I can offer much feedback.

    I want to help figure out why it doesn't work!

    Ok. Composing an email

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    I wanted to throw this out for the rest of the community.

    First: Thank you @PierceBoggan for reaching out and offering to help directly. I know your time is not your own and you have many projects on your plate.

    Second and this is to the community at large. Make sure everything and I mean everything is up-to-date on your system before trying LiveReload.

    Somehow after having tried this with 3 new "Welcome to Xamarin" solutions unsuccessfully the 4th time was a charm. I am personally convinced that there is an element of having everything being the right version INCLUDING the templates from which the solution was created. Every one of the past times I made sure all my everythings were up to date. Yet today when I came in to work, there are more updates to download. Including .NET Standard 2.03. Maybe that's the magic, maybe not. Maybe just having everything running the version v.today was the answer.

    No amount of work and updating of older projects based on pre-Forms3 templates work for me yet. But a new solution does. And honestly the LiveReload is pretty cool at least in a basic solution with no inheritence issues yet tested.

    I'm done wasting time trying to make the older solutions come up to date. I am not of fan of the solution being "make a new project and import all your old work". Often that is a HUGE undertaking. But in this case I think its less work to start from a pristine solution than to try to make an older one come up to date. Sometimes it is just best to start new, clean fresh.

    Again, thank you @PierceBoggan

  • ThomasEveringhamThomasEveringham USMember ✭✭

    Just FYI the solution I'm using LiveReload with is 12 months old, PackageReferences was the only update I made. I do understand the frustration of troubleshooting though

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    @ThomasEveringham said:
    Just FYI the solution I'm using LiveReload with is 12 months old, PackageReferences was the only update I made. I do understand the frustration of troubleshooting though

    You've only made 1 update in 12 months - but you're using LiveReload? How is that possible? LiveReload requires Xamarin.Forms 3 which is not 12 months old.

  • ThomasEveringhamThomasEveringham USMember ✭✭
    edited June 2018

    @ClintStLaurent to clarify: you were talking about using the most up-to-date template projects and importing old work into them, and it all being a huge undertaking etc. etc.

    I did none of that sort of thing with my 12 month old code base.

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    @ThomasEveringham
    Gotcha. To clarify we have an existing product that was based on VS Templates from over two years ago. So way old. It has gone through the typical bits of various nuget updates including the Xamarin.Forms nuget. In fact it was created before Xamarin was even included with VS and you had to buy Xamarin separately. So a lot of that "under the hood" file structure and protocol that has been hanging in for two years bears little resemblance to how things are done today.

    For the new product they tried to cut corners by just cloning that old solution then cutting away everything they didn't need. Bad approach. The years of evolution, typical problems when you stay on the cutting edge of packages that aren't working, PC's crash (it happens) etc., developers try to force course changes mid-developement, {...} has taken its toll on the first solution. Using it as a base for a new solution with all the latest and greatest features was never a good idea.

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    I can be pretty quick to b!tch when something doesn't work and I feel it should.
    I try to be just as fast to praise. Now that LiveReload is working (simple test app so far), I wanted to tip my hat to the Xamarin guys responsible for it. Its fast, responsive and works as advertised. Very cool to make a change in XAML, hit save, and see the update on both iOS and Android immediately.

    1. Confirmed: Works with StaticResource definitions for color and FontSize
    2. Confirmed: Updating app-wide definitions like Style also works. Well done!

    UPDATE: I kept increasing the complexity to show how it still handled everything - trying to be positive.

    Then it starts to break down on what it can handle.
    If I have a derived ContentView such as ContentViewBase : ContentView
    2. iOS doesn't show it at all
    3. Android doesn't show changes made on the derived control until I make changes on the ContentPage hosting the derived control.

    Still in Preview

    This is still in preview so I am not complaining. I think when they get it all working and in a true release version it will be a very valuable thing.

    CC: @PierceBoggan , @DanielCazzulino , @kzu

  • PierceBogganPierceBoggan USForum Administrator, Xamarin Team, Developer Group Leader Xamurai

    @ClintStLaurent Great to hear you're finding the concept solid so far!

    At the moment, everything flows through the ContentPage. We definitely plan to make things like derived controls work; you should just be able to save any XAML you are working on (be it a custom control, page, etc.), and, if the page is in the visible tree, have it update.

    I've done some more complex demos with things like the Infragistics Moo2u sample that has custom controls and uses Prism:
    https://www.screencast.com/t/v9nAiVfb2

    During this preview period, we definitely want to hear what's most important to you so we can prioritize that work (as you have already been doing, so thank you for that).

  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    @PierceBoggan said:
    During this preview period, we definitely want to hear what's most important to you so we can prioritize that work (as you have already been doing, so thank you for that).

    I lodged it on the Nuget:Issues so it can get in the reported/prioritization workflow.
    https://github.com/xamarin/Xamarin.Forms/issues/2942

    Or is there a better place to report things for a Preview feature?

  • PierceBogganPierceBoggan USForum Administrator, Xamarin Team, Developer Group Leader Xamurai

    Thanks for logging the issue! That is actually a great question. At the moment we don't have a public-facing place to report issues for Live Reload, that's probably something we should look into. :smile:

    I'll talk to the team and see if we can come up with a common sense solution.

Sign In or Register to comment.