eXpandFramework / eXpand

DevExpress XAF (eXpressApp) extension framework. 𝗹𝗶𝗻𝗸𝗲𝗱𝗶𝗻.𝗲𝘅𝗽𝗮𝗻𝗱𝗳𝗿𝗮𝗺𝗲𝘄𝗼𝗿𝗸.𝗰𝗼𝗺, 𝘆𝗼𝘂𝘁𝘂𝗯𝗲.𝗲𝘅𝗽𝗮𝗻𝗱𝗳𝗿𝗮𝗺𝗲𝘄𝗼𝗿𝗸.𝗰𝗼𝗺 and 𝘁𝘄𝗶𝘁𝘁𝗲𝗿 @𝗲𝘅𝗽𝗮𝗻𝗱𝗳𝗿𝗮𝗺𝗲𝘄𝗼𝗿𝗸 and or simply 𝗦𝘁𝗮𝗿/𝘄𝗮𝘁𝗰𝗵 this repository and get notified from 𝗚𝗶𝘁𝗛𝘂𝗯
http://expand.expandframework.com
Microsoft Public License
220 stars 114 forks source link

Error loading Model.DesignedDiffs.xafml after adding Expand.Xaf packages #963

Closed MarkAlvinReyes closed 7 months ago

MarkAlvinReyes commented 1 year ago

I already upgraded my project to DevExpress version 22.1.6 but I have an error loading the Model.DesignedDiffs.xafml and model.xafml after adding the following packages (Xpand.Xaf.Modules.Reactive, Xpand.XAF.Modules.JobScheduler.Hangfire and Xpand.XAF.Modules.Blazor) to my MySampleHangfire.Blazor.Server and MySampleHangfire.Module project. See the attached screenshot. I also attach here my sample project.

The error occurred after adding the below code in the constructor of the BlazorModule.cs file.

RequiredModuleTypes.Add(typeof(Xpand.XAF.Modules.Blazor.BlazorModule)); RequiredModuleTypes.Add(typeof(Xpand.XAF.Modules.Reactive.ReactiveModule)); RequiredModuleTypes.Add(typeof(Xpand.XAF.Modules.JobScheduler.Hangfire.JobSchedulerModule));

MySampleHangfire.zip ErrorLoadingModel

You can check the link below for the video recording I made to reproduce the issue.

https://supportcenter.devexpress.com/ticket/details/t1126554/how-to-add-model-assembly-job-source (Filename: ErrorExpandHangFire.mp4)

apobekiaris commented 1 year ago

thnks for the sample, I can repro the issue and will see to it. For now I was able to open ME by installing latest System.Interactive 6.0.1 to the Blazor.Server project and then restart VS.

MarkAlvinReyes commented 1 year ago

Thanks, apobekiaris! Please let me know when the fix for this will be available so that I can apply to my project.

MarkAlvinReyes commented 1 year ago

apobekiaris i tried to add the System.Interactive 6.0.1 to the Blazor.Server project but there was an error, See the attached image. Error_Adding_System_Inteactive_V6_0_1

apobekiaris commented 1 year ago

I do not think this error relates to eXpandFramework, it says the dir does not exist, so u probably uninstall DX. YOu can configure these dirs in your VS/Tools/Options/Nuget/Package Sources

MarkAlvinReyes commented 1 year ago

Thank you! issue was fixed after configuring the Nuget package sources. Just a follow-up question, how to create the objectspace in my class that has the JobProvider attribute? See the attached recording. As you can see the value of the Application property is NULL so I was not able to create objectspace. It was NULL because the constructor that has the BlazorApplication parameter was not being called. Is there any code i'm missing in order to call the constructor of my class?

https://user-images.githubusercontent.com/41627689/201475187-2039d88a-290c-4f67-9a18-33bf604bf114.mp4

apobekiaris commented 1 year ago

see the wiki for instructions on how to declare jobs

https://github.com/eXpandFramework/Reactive.XAF/tree/master/src/Modules/JobScheduler.Hangfire#details

MarkAlvinReyes commented 1 year ago

apobekiaris,

I have tried the code in your example but where i will get the ServiceProvider in the DailyTask method? By the way I changed the DailyTask method name to ProcessSegmentation. See the attached screenshot. Because when i try to use the ServiceProvider .RunWithStorageAsync is says that ServiceProvider does not contain a definition for 'RunWithStorageAsync. What is the namespace of the ServiceProvider that you used in the sample code?

ServiceProvider

RunWithStorageAsync_Error

apobekiaris commented 1 year ago

the ServiceProvider is the Provider docs are wrong I will update them

MarkAlvinReyes commented 1 year ago

Same with this example from here: https://www.youtube.com/watch?v=0LJ2bM1CfMg the Application property is NULL so there is no way you can create an objectspace. See the attached video recording. Even if I changed the property to Provider same as in my previous images the value of this property is also NULL.

https://user-images.githubusercontent.com/41627689/201525075-748cf3af-3e59-4b43-808f-4b405ea812b3.mp4

apobekiaris commented 1 year ago

this video uses an old version it is not possible to inject the BlazorApplication, instead there is the IServiceProvider. There are several u can follow or also u can llok at the TestApplication

https://github.com/eXpandFramework/Reactive.XAF/blob/master/src/Tests/JobScheduler.Hangfire/TestJob.cs

https://github.com/eXpandFramework/Reactive.XAF/blob/master/src/Tests/EasyTests/TestApplication/TestApplication.Module.Blazor/JobScheduler/Job.cs

MarkAlvinReyes commented 1 year ago

Thank you apobekiaris! The initialization of the ServiceProvider is now working. I just need to add the [ActivatorUtilitiesConstructor] attribute in the constructor with the ServiceProvider parameter. Now, when you click the Trigger button to execute the job, it will execute the code that I added. The problem now is after executing the job and then clicking the Refresh button there are no data shown in the Workers tab. See the attached video recording NoDataInWorkersTab.mp4. Is there anything I need to do to display the data in the Workers tab? In your example in Step 7 see the attached screenshot ObserveJobState.png is this the code that I need to add in order to display the data in the Workers tab? Where I will add this code?

https://user-images.githubusercontent.com/41627689/201894763-1ad0b66f-37d1-4b76-a21d-cab1738d88b4.mp4

ObserveJobState

apobekiaris commented 1 year ago

I recommend you either use the distributed symbols to actually debug the package and see what's wrong or another option is to compile the source using the quick you can read more on how easy it is to own the code at https://github.com/eXpandFramework/eXpand/issues/943

as you can read after u build the source u can simply load the JobScheduler project in your solution or any other package and build. If you set a breakpoint it will break or u can even modify it. Sorry I cannot repeat myself again all the info you need to master this framework is on #943

apobekiaris commented 1 year ago

about 7

public static IObservable<JobState> JobState => JobStateSubject.AsObservable();

thats the declaration of JobState so it is static so feel free to use it any place and remember to dispose it along with the container the same u do with any IDisposabel class or events etc

MarkAlvinReyes commented 1 year ago

Where does the data in the Workers tab came from? Or how it was generated? Is there any code that I need to add in order to display the data in the Workers tab?

apobekiaris commented 1 year ago

without a sample and spending time to research why u cannot see the Worker is not possible to answer u. In any case the worker is created at JobSchedulerService.ApplyJobState which is called from the Hangfire filter and since u go into your job I assume it went there. I would check if the worker is on my DB or I would debug the package as I mentioned

apobekiaris commented 1 year ago

the package as all the packages work as is or there will be explicit instructions in the wiki. In this case no instruction so as it is

apobekiaris commented 1 year ago

did you run the TestApplication from the source code? does it work there?

MarkAlvinReyes commented 1 year ago

Actually, i tried this one https://github.com/eXpandFramework/Reactive.XAF/blob/master/src/Tests/EasyTests/TestApplication/TestApplication.Module.Blazor/JobScheduler/Job.cs copy all the codes then execute the job. When i check the Hangfire.State table in the database there are records there but no data is displayed in the workers' tab.

HangfireState

apobekiaris commented 1 year ago

thnks I need time to review the testapplication apparently this is some kind of layout issue, data are there so they should be displayed unless the layout is broken. In the meantime feel free to open ME and play with the layout your self.

MarkAlvinReyes commented 1 year ago

And one thing apobekiaris maybe you can also check this one, every time I run my application and there is a job that runs Minutely I always get this error. See the attached screenshot.

DuplicateNameValidationError

FieldInfoWithTheSameNameError

expand commented 7 months ago

Closing issue for age. Feel free to reopen it at any time.

.Thank you for your contribution.