eXpandFramework / eXpand

DevExpress XAF (eXpressApp) extension framework. ๐—น๐—ถ๐—ป๐—ธ๐—ฒ๐—ฑ๐—ถ๐—ป.๐—ฒ๐˜…๐—ฝ๐—ฎ๐—ป๐—ฑ๐—ณ๐—ฟ๐—ฎ๐—บ๐—ฒ๐˜„๐—ผ๐—ฟ๐—ธ.๐—ฐ๐—ผ๐—บ, ๐˜†๐—ผ๐˜‚๐˜๐˜‚๐—ฏ๐—ฒ.๐—ฒ๐˜…๐—ฝ๐—ฎ๐—ป๐—ฑ๐—ณ๐—ฟ๐—ฎ๐—บ๐—ฒ๐˜„๐—ผ๐—ฟ๐—ธ.๐—ฐ๐—ผ๐—บ and ๐˜๐˜„๐—ถ๐˜๐˜๐—ฒ๐—ฟ @๐—ฒ๐˜…๐—ฝ๐—ฎ๐—ป๐—ฑ๐—ณ๐—ฟ๐—ฎ๐—บ๐—ฒ๐˜„๐—ผ๐—ฟ๐—ธ and or simply ๐—ฆ๐˜๐—ฎ๐—ฟ/๐˜„๐—ฎ๐˜๐—ฐ๐—ต this repository and get notified from ๐—š๐—ถ๐˜๐—›๐˜‚๐—ฏ
http://expand.expandframework.com
Microsoft Public License
222 stars 115 forks source link

The version of the โ€˜System. Interactiveโ€™ reference file is incorrect #1077

Open hedandan1989 opened 1 week ago

hedandan1989 commented 1 week ago

๐——๐—ฒ๐˜€๐—ฐ๐—ฟ๐—ถ๐—ฏ๐—ฒ ๐˜๐—ต๐—ฒ ๐—ฏ๐˜‚๐—ด An error occurs when updating Model. xafml while using Upload File Property Editor.

------- Updating model differences: Project: C:\Users\hedandan\source\repos\DXApplication4\DXApplication4.Blazor.Server\DXApplication4.Blazor.Server.csproj
Error:
System.BadImageFormatException: Could not load file or assembly 'System.Interactive, Version=5.0.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263'. Reference assemblies cannot be loaded for execution. (0x80131058)
File name: 'System.Interactive, Version=5.0.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263' ---> System.BadImageFormatException: Cannot load a reference assembly for execution.
   at Xpand.XAF.Modules.Reactive.Services.AttributesExtensions.<>c.<InvisibleInAllViewsAttribute>b__15_1(ValueTuple`2[] attributes)
   at System.Reactive.Linq.ObservableImpl.SelectMany`2.EnumerableSelector._.OnNext(TSource value)
--- End of stack trace from previous location ---
   at System.Reactive.PlatformServices.ExceptionServicesImpl.Rethrow(Exception exception)
   at System.Reactive.ExceptionHelpers.Throw(Exception exception)
   at System.Reactive.Stubs.<>c.<.cctor>b__2_1(Exception ex)
   at System.Reactive.AnonymousSafeObserver`1.OnError(Exception error)
   at System.Reactive.Sink`1.ForwardOnError(Exception error)
   at System.Reactive.Linq.ObservableImpl.Catch`2._.OnError(Exception error)
   at System.Reactive.Linq.ObservableImpl.ThrowImmediate`1.Run(IObserver`1 observer)
   at System.Reactive.BasicProducer`1.SubscribeRaw(IObserver`1 observer, Boolean enableSafeguard)
   at System.ObservableExtensions.SubscribeSafe[T](IObservable`1 source, IObserver`1 observer)
   at System.Reactive.Linq.ObservableImpl.Catch`2._.OnError(Exception error)
   at System.Reactive.Sink`1.ForwardOnError(Exception error)
   at System.Reactive.HalfSerializer.ForwardOnError[T](ISink`1 sink, Exception ex, Int32& wip, Exception& error)
   at System.Reactive.Linq.ObservableImpl.TakeUntil`2._.OnError(Exception ex)
   at System.Reactive.Linq.ObservableImpl.Merge`1.Observables._.InnerObserver.OnError(Exception error)
   at System.Reactive.Linq.ObservableImpl.Merge`1.Observables._.InnerObserver.OnError(Exception error)
   at System.Reactive.Linq.ObservableImpl.Merge`1.Observables._.InnerObserver.OnError(Exception error)
   at System.Reactive.Linq.ObservableImpl.Merge`1.Observables._.InnerObserver.OnError(Exception error)
   at System.Reactive.Linq.ObservableImpl.Merge`1.Observables._.InnerObserver.OnError(Exception error)
   at System.Reactive.Linq.ObservableImpl.Merge`1.Observables._.InnerObserver.OnError(Exception error)
   at System.Reactive.Linq.ObservableImpl.Merge`1.Observables._.InnerObserver.OnError(Exception error)
   at System.Reactive.Linq.ObservableImpl.Merge`1.Observables._.InnerObserver.OnError(Exception error)
   at System.Reactive.Linq.ObservableImpl.Merge`1.Observables._.InnerObserver.OnError(Exception error)
   at System.Reactive.Linq.ObservableImpl.Merge`1.Observables._.InnerObserver.OnError(Exception error)
   at System.Reactive.Linq.ObservableImpl.Merge`1.Observables._.InnerObserver.OnError(Exception error)
   at System.Reactive.Linq.ObservableImpl.Merge`1.Observables._.InnerObserver.OnError(Exception error)
   at System.Reactive.Linq.ObservableImpl.Merge`1.Observables._.InnerObserver.OnError(Exception error)
   at System.Reactive.Linq.ObservableImpl.Merge`1.Observables._.InnerObserver.OnError(Exception error)
   at System.Reactive.Linq.ObservableImpl.Merge`1.Observables._.InnerObserver.OnError(Exception error)
   at System.Reactive.Linq.ObservableImpl.Merge`1.Observables._.InnerObserver.OnError(Exception error)
   at System.Reactive.Sink`1.ForwardOnError(Exception error)
   at System.Reactive.Sink`2.OnError(Exception error)
   at System.Reactive.Sink`1.ForwardOnError(Exception error)
   at System.Reactive.Sink`2.OnError(Exception error)
   at System.Reactive.Sink`1.ForwardOnError(Exception error)
   at System.Reactive.Linq.ObservableImpl.SelectMany`2.ObservableSelectorIndexed._.OnError(Exception error)
   at System.Reactive.Sink`1.ForwardOnError(Exception error)
   at System.Reactive.Linq.ObservableImpl.SelectMany`2.ObservableSelectorIndexed._.OnError(Exception error)
   at System.Reactive.Sink`1.ForwardOnError(Exception error)
   at System.Reactive.Linq.ObservableImpl.SelectMany`2.ObservableSelectorIndexed._.OnError(Exception error)
   at System.Reactive.Sink`1.ForwardOnError(Exception error)
   at System.Reactive.Linq.ObservableImpl.SelectMany`2.ObservableSelectorIndexed._.OnError(Exception error)
   at System.Reactive.Sink`1.ForwardOnError(Exception error)
   at System.Reactive.Linq.ObservableImpl.SelectMany`2.ObservableSelectorIndexed._.InnerObserver.OnError(Exception error)
   at System.Reactive.Sink`1.ForwardOnError(Exception error)
   at System.Reactive.Sink`2.OnError(Exception error)
   at System.Reactive.Sink`1.ForwardOnError(Exception error)
   at System.Reactive.Sink`2.OnError(Exception error)
   at System.Reactive.Sink`1.ForwardOnError(Exception error)
   at System.Reactive.Sink`2.OnError(Exception error)
   at System.Reactive.Sink`1.ForwardOnError(Exception error)
   at System.Reactive.Sink`2.OnError(Exception error)
   at System.Reactive.Sink`1.ForwardOnError(Exception error)
   at System.Reactive.Linq.ObservableImpl.SelectMany`2.EnumerableSelector._.OnNext(TSource value)
   at System.Reactive.Linq.ObservableImpl.ReturnImmediate`1.Run(IObserver`1 observer)
   at System.Reactive.BasicProducer`1.SubscribeRaw(IObserver`1 observer, Boolean enableSafeguard)
   at System.ObservableExtensions.SubscribeSafe[T](IObservable`1 source, IObserver`1 observer)
   at System.Reactive.Sink`2.Run(IObservable`1 source)
   at System.Reactive.Linq.ObservableImpl.SelectMany`2.EnumerableSelector.Run(_ sink)
   at System.Reactive.Producer`2.SubscribeRaw(IObserver`1 observer, Boolean enableSafeguard)
   at System.ObservableExtensions.SubscribeSafe[T](IObservable`1 source, IObserver`1 observer)
   at System.Reactive.Sink`2.Run(IObservable`1 source)
   at System.Reactive.Linq.ObservableImpl.IgnoreElements`1.Run(_ sink)
   at System.Reactive.Producer`2.SubscribeRaw(IObserver`1 observer, Boolean enableSafeguard)
   at System.ObservableExtensions.SubscribeSafe[T](IObservable`1 source, IObserver`1 observer)
   at System.Reactive.Sink`2.Run(IObservable`1 source)
   at System.Reactive.Linq.ObservableImpl.Select`2.Selector.Run(_ sink)
   at System.Reactive.Producer`2.SubscribeRaw(IObserver`1 observer, Boolean enableSafeguard)
   at System.ObservableExtensions.SubscribeSafe[T](IObservable`1 source, IObserver`1 observer)
   at System.Reactive.Sink`2.Run(IObservable`1 source)
   at System.Reactive.Linq.ObservableImpl.Where`1.Predicate.Run(_ sink)
   at System.Reactive.Producer`2.SubscribeRaw(IObserver`1 observer, Boolean enableSafeguard)
   at System.ObservableExtensions.SubscribeSafe[T](IObservable`1 source, IObserver`1 observer)
   at System.Reactive.TailRecursiveSink`1.Drain()
   at System.Reactive.TailRecursiveSink`1.Run(IEnumerable`1 sources)
   at System.Reactive.Linq.ObservableImpl.Concat`1.Run(_ sink)
   at System.Reactive.Producer`2.<>c.<SubscribeRaw>b__1_0(ValueTuple`2 tuple)
   at System.Reactive.Concurrency.Scheduler.<>c__75`1.<ScheduleAction>b__75_0(IScheduler _, ValueTuple`2 tuple)
   at System.Reactive.Concurrency.CurrentThreadScheduler.Schedule[TState](TState state, TimeSpan dueTime, Func`3 action)
   at System.Reactive.Concurrency.LocalScheduler.Schedule[TState](TState state, Func`3 action)
   at System.Reactive.Concurrency.Scheduler.ScheduleAction[TState](IScheduler scheduler, TState state, Action`1 action)
   at System.Reactive.Producer`2.SubscribeRaw(IObserver`1 observer, Boolean enableSafeguard)
   at System.ObservableExtensions.SubscribeSafe[T](IObservable`1 source, IObserver`1 observer)
   at System.Reactive.Linq.ObservableImpl.SelectMany`2.ObservableSelectorIndexed._.SubscribeInner(IObservable`1 inner)
   at System.Reactive.Linq.ObservableImpl.SelectMany`2.ObservableSelectorIndexed._.OnNext(TSource value)
   at System.Reactive.Sink`1.ForwardOnNext(TTarget value)
   at System.Reactive.Linq.ObservableImpl.Select`2.Selector._.OnNext(TSource value)
   at System.Reactive.Sink`1.ForwardOnNext(TTarget value)
   at System.Reactive.Linq.ObservableImpl.Select`2.Selector._.OnNext(TSource value)
   at System.Reactive.Subjects.Subject`1.OnNext(T value)
   at System.Reactive.Linq.ObservableImpl.FromEventPattern.Impl`2.<>c__DisplayClass3_0.<GetHandler>b__0(Object sender, TEventArgs eventArgs)
   at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
   at DevExpress.ExpressApp.ApplicationModulesManager.OnCustomizeTypesInfo(ITypesInfo typesInfo)
   at DevExpress.ExpressApp.ApplicationModulesManager.DoCustomizeTypesInfo(ITypesInfo typesInfo)
   at DevExpress.ExpressApp.ApplicationModulesManager.LoadTypesInfo(ITypesInfo typesInfo)
   at DevExpress.ExpressApp.ApplicationModulesManager.Load(ITypesInfo typesInfo, Boolean loadTypesInfo)
   at DevExpress.ExpressApp.Utils.DesignerModelFactory.CreateModulesManager(XafApplication application, String configFileName, String assembliesPath, Action initializeTypeInfoSources)
   at DevExpress.ExpressApp.Design.ModelUpdater.UpdateModel(ProjectReference projectReference)
   at DevExpress.ExpressApp.Design.ModelUpdater.UpdateModel(ModelUpdater modelUpdater, ProjectReference projectReference, OutputWindowPane outputWindow)
Update failed

๐—ง๐—ผ ๐—ฅ๐—ฒ๐—ฝ๐—ฟ๐—ผ๐—ฑ๐˜‚๐—ฐ๐—ฒ

  1. Add a NUGET reference to the DXApplication4.Blazor. Server project
  2. Add assembly reference to Program.cs
    [assembly: HostingStartup(typeof(Xpand.Extensions.Blazor.HostingStartup))]
    [assembly: HostingStartup(typeof(Xpand.XAF.Modules.Blazor.BlazorStartup))]
    namespace DXApplication4.Blazor.Server;
  3. Add BlazorModule reference to module.cs in the Blazor project RequiredModuleTypes.Add(typeof(Xpand.XAF.Modules.Blazor.BlazorModule));
  4. Generate project
  5. Right click on the blazor.server project and click on update model ๐—˜๐˜…๐—ฝ๐—ฒ๐—ฐ๐˜๐—ฒ๐—ฑ ๐—ฏ๐—ฒ๐—ต๐—ฎ๐˜ƒ๐—ถ๐—ผ๐—ฟ Unable to find file version 5.0.0.0 in the error message, but the compiled file version is 5.0.0.1 ๐—ฆ๐—ฐ๐—ฟ๐—ฒ๐—ฒ๐—ป๐˜€๐—ต๐—ผ๐˜๐˜€ image

Here is he demo. DXApplication4.zip

apobekiaris commented 5 days ago
<PackageReference Include="System.Interactive" Version="6.0.1" />
<PackageReference Include="System.Interactive.Async" Version="6.0.1" />

add it in your Blazor project and let me know if it worked

yunits commented 4 days ago

after adding these packages to your project rebuild your solution. To see Model Editor again you also need restart visual studio

hedandan1989 commented 3 days ago

Thank you. After installing specific packages, there were no more error messages. But a new issue arose, the uploadpropertyeditor was not displayed in model.xafml, and even if I specified the editor in the code, it still wouldn't work. After opening the page, it is still a regular listview.

here is the code. `[DefaultClassOptions] [DefaultProperty(nameof(Name))] public class Emplyee : BaseObject { public Emplyee(Session session) : base(session) { }

string fName;

[Size(SizeAttribute.DefaultStringMappingFieldSize)]
public string Name
{
    get => fName;
    set => SetPropertyValue(nameof(Name), ref fName, value);
}

[PersistentAlias("EmployeeDatas.Count")]
[EditorAlias(nameof(DisplayTextPropertyEditor))]
public int FileCount => (int)EvaluateAlias();

[Association("Emplyee-EmployeeDatas")]
[EditorAlias("UploadFilePropertyEditor")]
public XPCollection<EmployeeFileData> EmployeeDatas
{
    get
    {
        return GetCollection<EmployeeFileData>(nameof(EmployeeDatas));
    }
}

}

//[DefaultClassOptions] public class EmployeeFileData : FileData { public EmployeeFileData(Session session) : base(session) { }

Emplyee fEmployee;

[Association("Emplyee-EmployeeDatas")]
public Emplyee Employee
{
    get => fEmployee;
    set => SetPropertyValue(nameof(Employee), ref fEmployee, value);
}

}`

here is the screenshot,there is no uploadpropertyeditor. image

here is the sample. DXApplication5.zip

apobekiaris commented 17 hours ago

probably some breaking change in the Xaf code or improvment. In any case you can workaround it like

public IEnumerable<IFileData> Datas => EmployeeDatas;

also if u have the time u can create your custom editor without any implementation mark it with [PropertyEditor(typeof(IEnumerable<IFileData>),EditorAliases.UploadFile, false)], create a sample and ask in DX support center explaining to them that the time I recorded the video in the wiki it was working