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

[API] Issue when attempting to execute run command through API #769

Closed
RichiCoder1 opened this issue Jun 2, 2016 · 7 comments
Closed

[API] Issue when attempting to execute run command through API #769

RichiCoder1 opened this issue Jun 2, 2016 · 7 comments

Comments

@RichiCoder1
Copy link
Member

RichiCoder1 commented Jun 2, 2016

What You Are Seeing?

An exception when running any sort of run() command.

What is Expected?

Executing a run command should work fine.

How Did You Get This To Happen? (Steps to Reproduce)

With the latest chocolatey.lib 0.9.10-beta-20160531 trying and run:

           var choco = Lets.GetChocolatey();
            choco.Set(
                config =>
                {
                    config.CommandName = "source";
                    config.SourceCommand.Command = SourceCommandType.add;
                    config.SourceCommand.Name = "test";
                    config.Sources = "c:\\packages\\";
                    config.AllowUnofficialBuild = true;
                });

            choco.Run();

Output Log

The type initializer for 'System.Reactive.Linq.Observable' threw an exception.
   at System.Reactive.Linq.Observable.OfType[TResult](IObservable`1 source)
   at chocolatey.infrastructure.services.EventSubscriptionManagerService.subscribe[Event](Action`1 handleEvent, Action`1 handleError, Func`2 filter)
   at chocolatey.infrastructure.app.tasks.RemovePendingPackagesTask.initialize()
   at chocolatey.infrastructure.app.runners.GenericRunner.run(ChocolateyConfiguration config, Container container, Boolean isConsole, Action`1 parseArgs)
   at chocolatey.GetChocolatey.Run()
   at ChocolateyGui.Utilities.Extensions.ChocolateyExtensions.<>c__DisplayClass0_0.<RunAsync>b__0() in C:\Source\FOSS\ChocolateyGUI\Source\ChocolateyGui\Utilities\Extensions\ChocolateyExtensions.cs:line 19
   at System.Threading.Tasks.Task.Execute()
{"Could not load file or assembly 'System.Reactive.PlatformServices, Version=0.9.10.0, Culture=neutral, PublicKeyToken=79d02ea9cad655eb' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)":"System.Reactive.PlatformServices, Version=0.9.10.0, Culture=neutral, PublicKeyToken=79d02ea9cad655eb"}
@ferventcoder
Copy link
Member

That looks bad - definitely an issue. Looks like something was not set up properly for the container.

@ferventcoder ferventcoder added this to the 0.9.10 milestone Jun 2, 2016
@ferventcoder ferventcoder changed the title Issue when attempting to execute run command through Core Lib Issue when attempting to execute run command through API Jun 3, 2016
@RichiCoder1
Copy link
Member Author

I'll look into this soon myself too. This is def very blocking issue

@RichiCoder1
Copy link
Member Author

I'm looking into this, and I honestly am at a loss. Why doesn't Choco.exe error, but chocolatey.lib does? Hmmm.

@RichiCoder1
Copy link
Member Author

RichiCoder1 commented Jun 3, 2016

Ohhhhhh. It looks like the issue is we're both using Reactive, but you're using a much older, and different version.

Edit: Monkey patched this by adding this code in ChocolateyGUI:

        private static System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
        {
            if (args.Name ==
                "System.Reactive.PlatformServices, Version=0.9.10.0, Culture=neutral, PublicKeyToken=79d02ea9cad655eb")
            {
                return typeof(chocolatey.Lets).Assembly;
            }
            else
            {
                return null;
            }
        }

@ferventcoder
Copy link
Member

That's a start...I wonder if I should do that for all things where the public key token is Chocolatey's and load them.

ferventcoder added a commit to ferventcoder/choco that referenced this issue Jun 4, 2016
When using the API, it should resolve merged assemblies but it may
not if there is an assembly handler registered. Before loading up
code that resolves external assemblies, register an AssemblyResolve
handler with the purpose of determining if the assembly has
Chocolatey's Public Key token or not. If it does, use Chocolatey's
merged assembly instead of the conflicting assembly.
@ferventcoder
Copy link
Member

ferventcoder commented Jun 4, 2016

@RichiCoder1 can you take a look at #776?

@ferventcoder
Copy link
Member

I think #776 may be the answer here, but it will need validated on the next beta release (to show that it is not too late by then to register the handler).

ferventcoder added a commit that referenced this issue Jun 5, 2016
…ly-handler

(GH-769) API - Resolve Merged Assemblies
ferventcoder added a commit that referenced this issue Jun 5, 2016
* stable:
  (maint) use case insensitive compare for token
  (GH-769) API - Resolve Merged Assemblies
@ferventcoder ferventcoder self-assigned this Jun 5, 2016
@ferventcoder ferventcoder changed the title Issue when attempting to execute run command through API [API] Issue when attempting to execute run command through API Aug 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants