kswoll / ReactiveUI.Fody

C# Fody extension to generate RaisePropertyChange notifications for properties and ObservableAsPropertyHelper properties.
MIT License
154 stars 31 forks source link

ReactiveUI 6.5.0.0 #21

Closed Evangelink closed 8 years ago

Evangelink commented 8 years ago

I have a project using ReactiveUI 6.5.0.0 on which I have just installed your nuget. I now end-up with an application crash saying it can't find ReactiveUI 6.4.0.1. The dependency is properly set to >= on your nuget not = so this should work, isnt' it? I also tried to put a binding redirection into the app.config but except if the key I put is wrong the binding didn't worked.

Any idea?

kswoll commented 8 years ago

I tried to repro on a sample project and was unable to see a crash. Can you provide your full stack trace and if possible, isolate it into a project you could upload? Thanks!

Evangelink commented 8 years ago

I also tried it on a simple WPF project and I didn't had any issue... I am trying to use your plugin within a modular application (prism) and I have the following errors:

Exception thrown: 'System.IO.FileLoadException' in mscorlib.dll

Additional information: API restriction: The assembly 'file:///C:\Src\***\ReactiveUI.dll' has already loaded from a different location. It cannot be loaded from a new location within the same appdomain.

and

Exception thrown: 'System.IO.FileLoadException' in mscorlib.dll

Additional information: Could not load file or assembly 'ReactiveUI, Version=6.4.0.1, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Could not find or load a specific file. (Exception from HRESULT: 0x80131621)

Note that the Portal part has already loaded a version of ReactiveUI. I am going to try and make a little repro case.

Evangelink commented 8 years ago

Can you confirm that the ReactiveUI.Fody.Helpers should not be shipped to the production environment? If I have correctly understood the behavior, this is only required while compiling to update the output dll with the extra plumbing code.

It seems that if I remove the ReactiveUI.Fody.Helpers dll from my portal folder everything works properly.

kswoll commented 8 years ago

Given those errors, it really sounds like you still have two versions of reactiveui's assembly in two separate locations. You may want to check your packages folder to see if there are two versions of reactiveui-core present. Failing that, maybe do a search for that assembly wherever your app is picking up assemblies.

As to your other question, the helpers assembly is only neccessary at runtime if you use the .ToPropertyEx(...) method in conjunction with [ObservableAsProperty], as that's the assembly wherein that method is defined.

Evangelink commented 8 years ago

Ok so for now I can only see 2 dlls of ReactiveUI (one in the portal folder and one in the modules folder) they are both the same size, date and version. If I skip copying ReactiveUI.Fody.Helpers dll, I have no error.

I can see on the output that your dll loads the proper version of ReactiveUI:

7>    Fody: Fody (version 1.29.4.0) Executing
7>      Fody/ReactiveUI:   ReactiveUI 6.5.0.0
7>      Fody/ReactiveUI:   ReactiveUI.Fody.Helpers 1.1.52.0
7>      Fody/ReactiveUI:   ReactiveUI 6.5.0.0
7>      Fody/ReactiveUI:   ReactiveUI.Fody.Helpers 1.1.52.0
7>    Fody:   Finished Fody 685ms.
7>  SIRS.Gas.Module.Incidents -> C:\Src\***.dll
7>    Fody:   Skipped Verifying assembly since it is disabled in configuration
7>    Fody:   Finished verification in 2ms.

So it is probably coming from somewhere else....Probably on our side...

EDIT: If I change all OAPH to use your nuget syntax I end up with the following error message while compiling: Extension 'Microsoft.Activities.Build.Validation.ValidationBuildExtension' threw an exception of type 'System.Reflection.ReflectionTypeLoadException' : 'Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.'.

kswoll commented 8 years ago

Sorry, not totally following what you mean by "OAPH" and "my nuget syntax", can you elaborate?

Evangelink commented 8 years ago

Oh sorry about that. OAPH = ObservableAsPropertyHelper. And what I meant by using your syntax is o actually replace the the ToProperty by ToPropertyEx and accordingly replace the property (from x.Value to the attribute with the extern keyword).

I am still trying to understand where the problem is coming from and at this point I am not sure it is linked to your package.

Evangelink commented 8 years ago

I am still working on the issue (not full time) and I was wondering why you have a dependency to reactiveui-core and not reactiveui? I am not sure it does change something but I was just wondering.

kswoll commented 8 years ago

reactiveui depends on reactiveui-core

I'm not entirely sure what the reasonsing is that made them split it up into two separate nuget packages, but reactiveui doesn't actually contain any assemblies. All the classes are contained in reactiveui-core, thus ReactiveUI.Fody has a dependency on that package.

Evangelink commented 8 years ago

So the problem come from Prism dll loading but at this point I am not sure how to deal with this. Anyway I am closing this issue as it is not linked to your package.

kswoll commented 8 years ago

OK, thanks for circling back!