I am trying to create a new MAUI app using the latest version of AspNetZero and have followed the step-by-step instructions in the documentation to create a new page for the Blazor mobile app. I have created my proxy in the Application.Client project and in my constructor for my page I call DependencyResolver.Resolve<IExpensesAppService>() but that throws an exception;
No component for supporting the service IExpensesAppService was found.
The proxy (ProxyExpensesAppService) is defined using ProxyAppServiceBase, IExpensesAppService and all of the methods for the interface have been defined appropriately by calling the corresponding await ApiClient... function. As far as I can tell there is no other step required to make the implementation of the interface available.
Please provide information on why the service cannot be resolved.
23 Answer(s)
-
0
I found a similar issue #11537 that resolved the initial problem of not resolving service. My proxy was named ProxyExpenseAppService and the interface is IExpensesAppService. Once I changed the proxy name to ProxyExpensesAppService it resolved correctly.
HOWEVER, when I attempt to make the call to a method on the proxy it never actually executes. I put a breakpoint in the SetBusyAsync method in the {myProject}ComponentBase on the await func(); call and it never hits it. In my InitializedAsync() method I had originally put a call to await UserDialogsService.Block() and it never allowed execution past that call. That same call is the first line of the SetBusyAsync() method and it appears it never goes past that call there either.
I need to get this working and don't know how to get past this issue.
-
0
Hi,
Could you share
ProxyExpenseAppService
implementation and how you are calling it ? -
0
Here is the relevant portions of the Proxy:
using Abp.Application.Services.Dto; using myproject.Dto; using myproject.Expenses.Dtos; using System; using System.Collections.Generic; using System.Text; using System.Threading.Tasks;
namespace myproject.Expenses { public class ProxyExpensesAppService : ProxyAppServiceBase, IExpensesAppService { public async Task CreateOrEdit(CreateOrEditExpenseDto input) { await ApiClient.PostAsync(GetEndpoint(nameof(CreateOrEdit)), input); }
public async Task Delete(EntityDto<Guid> input) { await ApiClient.DeleteAsync(GetEndpoint(nameof(Delete)), input); } public async Task<PagedResultDto<GetExpenseForViewDto>> GetActiveForPatient(GetAllExpensesInput input) { return await ApiClient.GetAsync<PagedResultDto<GetExpenseForViewDto>>(GetEndpoint(nameof(GetActiveForPatient)), input); } public async Task<PagedResultDto<GetExpenseForViewDto>> GetActiveForUser() { return await ApiClient.GetAsync<PagedResultDto<GetExpenseForViewDto>>(GetEndpoint(nameof(GetActiveForUser))); } }
}
Here is the method that calls the proxy:
private async Task GetList() { await SetBusyAsync(async () => { await WebRequestExecuter.Execute( async () => await _expensesAppService.GetActiveForUser(), (result) => { pendingExpenses.Clear(); approvedExpenses.Clear(); deniedExpenses.Clear(); foreach (var exp in result.Items) { if (exp.Expense.ApprovalStatus == Enums.CareEventStatuses.Pending) { ExpenseListModel expense = new ExpenseListModel() { Amount = exp.Expense.Amount, Payee = exp.Expense.Payee, ExpenseType = exp.Expense.ExpenseType, ReceivedDate = exp.Expense.ReceivedDate }; pendingExpenses.Add(expense); } else if (exp.Expense.ApprovalStatus == Enums.CareEventStatuses.Approved) { ExpenseListModel expense = new ExpenseListModel() { Amount = exp.Expense.Amount, Payee = exp.Expense.Payee, ExpenseType = exp.Expense.ExpenseType, ReceivedDate = exp.Expense.ReceivedDate }; approvedExpenses.Add(expense); } else { ExpenseListModel expense = new ExpenseListModel() { Amount = exp.Expense.Amount, Payee = exp.Expense.Payee, ExpenseType = exp.Expense.ExpenseType, ReceivedDate = exp.Expense.ReceivedDate }; deniedExpenses.Add(expense); } } return Task.CompletedTask; }); }); }
-
0
Hi,
It all seems fine. Is it possible for you to share your project with [email protected] ?
-
0
-
0
Again, the proxy is never hit. I've restarted Visual Studio and ensured that all applicable patches have been installed. For some reason it doesn't appear to know about the proxy service. Confused and dazed.
-
0
I downloaded the starter project again from your website and added my proxy for Expenses into it, add the supporting files in the various projects (dto's and other needed files), added the page and the menu item to access it and it never hits the proxy. Is there some type of registration that has to happen for the proxy to work that I am missing??
-
0
Hi,
Sometimes Visual Studio might not catch the breakpoint. Could you try deleting
bin
andobj
folders (if you are on a Windows machine, you can useDelete-BIN-OBJ-Folders.bat
file), rebuild the solution and try to debug again ? -
0
I have done that a couple times. The latest trial was on a brand new download of the base solution and just adding in the proxy and one page as a test. The app never goes to the page and just hangs after the constructor for the page. Nothing is working in my code.
-
0
Thanks. In that case, could you share the classes you have added to an empty solution, so we can reproduce the problem on our side and check it.
-
0
using Abp.Application.Services.Dto; using simul_bcfo.Dto; using simul_bcfo.Expenses.Dtos; using System; using System.Collections.Generic; using System.Text; using System.Threading.Tasks;
namespace simul_bcfo.Expenses { public class ProxyExpensesAppService : ProxyAppServiceBase, IExpensesAppService { public async Task CreateOrEdit(CreateOrEditExpenseDto input) { await ApiClient.PostAsync(GetEndpoint(nameof(CreateOrEdit)), input); }
public async Task Delete(EntityDto<Guid> input) { await ApiClient.DeleteAsync(GetEndpoint(nameof(Delete)), input); } public async Task<PagedResultDto<GetExpenseForViewDto>> GetActiveForPatient(GetAllExpensesInput input) { return await ApiClient.GetAsync<PagedResultDto<GetExpenseForViewDto>>(GetEndpoint(nameof(GetActiveForPatient)), input); } public async Task<PagedResultDto<GetExpenseForViewDto>> GetActiveForUser() { return await ApiClient.GetAsync<PagedResultDto<GetExpenseForViewDto>>(GetEndpoint(nameof(GetActiveForUser))); } public async Task<PagedResultDto<GetExpenseForViewDto>> GetAll(GetAllExpensesInput input) { return await ApiClient.GetAsync<PagedResultDto<GetExpenseForViewDto>>(GetEndpoint(nameof(GetAll)), input); } public async Task<List<ExpenseCareEventLookupTableDto>> GetAllCareEventForTableDropdown() { return await ApiClient.GetAsync<List<ExpenseCareEventLookupTableDto>>(GetEndpoint(nameof(GetAllCareEventForTableDropdown))); } public async Task<List<ExpenseExpenseTypeLookupTableDto>> GetAllExpenseTypeForTableDropdown() { return await ApiClient.GetAsync<List<ExpenseExpenseTypeLookupTableDto>>(GetEndpoint(nameof(GetAllExpenseTypeForTableDropdown))); } public async Task<PagedResultDto<ExpensePatientLookupTableDto>> GetAllPatientForLookupTable(GetAllForLookupTableInput input) { return await ApiClient.GetAsync<PagedResultDto<ExpensePatientLookupTableDto>>(GetEndpoint(nameof(GetAllPatientForLookupTable)), input); } public async Task<PagedResultDto<ExpensePayeeLookupTableDto>> GetAllPayeeForLookupTable(GetAllForLookupTableInput input) { return await ApiClient.GetAsync<PagedResultDto<ExpensePayeeLookupTableDto>>(GetEndpoint(nameof(GetAllPayeeForLookupTable)), input); } public async Task<List<ExpensePaymentMethodLookupTableDto>> GetAllPaymentMethodForTableDropdown() { return await ApiClient.GetAsync<List<ExpensePaymentMethodLookupTableDto>>(GetEndpoint(nameof(GetAllPaymentMethodForTableDropdown))); } public async Task<PagedResultDto<ExpenseUserLookupTableDto>> GetAllUserForLookupTable(GetAllForLookupTableInput input) { return await ApiClient.GetAsync<PagedResultDto<ExpenseUserLookupTableDto>>(GetEndpoint(nameof(GetAllUserForLookupTable)), input); } public async Task<GetExpenseForEditOutput> GetExpenseForEdit(EntityDto<Guid> input) { return await ApiClient.GetAsync<GetExpenseForEditOutput>(GetEndpoint(nameof(GetExpenseForEdit)), input); } public async Task<GetExpenseForViewDto> GetExpenseForView(Guid id) { return await ApiClient.GetAsync<GetExpenseForViewDto>(GetEndpoint(nameof(GetExpenseForView)), id); } public async Task<FileDto> GetExpensesToExcel(GetAllExpensesForExcelInput input) { return await ApiClient.GetAsync<FileDto>(GetEndpoint(nameof(GetExpensesToExcel)), input); } public async Task RemoveImage1File(EntityDto<Guid> input) { await ApiClient.PostAsync(GetEndpoint(nameof(RemoveImage1File)), input); } public async Task RemoveImage2File(EntityDto<Guid> input) { await ApiClient.PostAsync(GetEndpoint(nameof(RemoveImage2File)), input); } public async Task RemoveImage3File(EntityDto<Guid> input) { await ApiClient.PostAsync(GetEndpoint(nameof(RemoveImage3File)), input); } }
}
using System; using System.Threading.Tasks; using Abp.Application.Services; using Abp.Application.Services.Dto; using simul_bcfo.Expenses.Dtos; using simul_bcfo.Dto; using System.Collections.Generic;
namespace simul_bcfo.Expenses { public interface IExpensesAppService : IApplicationService { Task<PagedResultDto<GetExpenseForViewDto>> GetActiveForUser(); Task<PagedResultDto<GetExpenseForViewDto>> GetActiveForPatient(GetAllExpensesInput input); Task<PagedResultDto<GetExpenseForViewDto>> GetAll(GetAllExpensesInput input);
Task<GetExpenseForViewDto> GetExpenseForView(Guid id); Task<GetExpenseForEditOutput> GetExpenseForEdit(EntityDto<Guid> input); Task CreateOrEdit(CreateOrEditExpenseDto input); Task Delete(EntityDto<Guid> input); Task<FileDto> GetExpensesToExcel(GetAllExpensesForExcelInput input); Task<PagedResultDto<ExpensePayeeLookupTableDto>> GetAllPayeeForLookupTable(GetAllForLookupTableInput input); Task<List<ExpenseExpenseTypeLookupTableDto>> GetAllExpenseTypeForTableDropdown(); Task<List<ExpensePaymentMethodLookupTableDto>> GetAllPaymentMethodForTableDropdown(); Task<PagedResultDto<ExpensePatientLookupTableDto>> GetAllPatientForLookupTable(GetAllForLookupTableInput input); Task<List<ExpenseCareEventLookupTableDto>> GetAllCareEventForTableDropdown(); Task<PagedResultDto<ExpenseUserLookupTableDto>> GetAllUserForLookupTable(GetAllForLookupTableInput input); Task RemoveImage1File(EntityDto<Guid> input); Task RemoveImage2File(EntityDto<Guid> input); Task RemoveImage3File(EntityDto<Guid> input); }
}
using Microsoft.AspNetCore.Components.Web.Virtualization; //using simul_bcfo.CareEvents; using simul_bcfo.Core.Dependency; using simul_bcfo.Core.Threading; using simul_bcfo.Expenses; using simul_bcfo.Expenses.Dtos; using simul_bcfo.Mobile.MAUI.Models.Expenses; using simul_bcfo.Mobile.MAUI.Shared; using simul_bcfo.Services.Navigation; //using Volo.Abp.Users;
namespace simul_bcfo.Mobile.MAUI.Pages.Expenses { public partial class Index : simul_bcfoMainLayoutPageComponentBase { protected INavigationService navigationService { get; set; } protected IExpensesAppService _expensesAppService { get; set; } //protected ICareEventsAppService _careEventsAppService { get; set; } protected List<ExpenseListModel> pendingExpenses = new List<ExpenseListModel>(); protected List<ExpenseListModel> approvedExpenses = new List<ExpenseListModel>(); protected List<ExpenseListModel> deniedExpenses = new List<ExpenseListModel>();
private AddExpenseModal addExpenseModal { get; set; } private string showPending = ""; private string showApproved = "hidden"; private string showDenied = "hidden"; public Index() { try { _expensesAppService = DependencyResolver.Resolve<IExpensesAppService>(); navigationService = DependencyResolver.Resolve<INavigationService>(); } catch(Exception ex) { Console.WriteLine(ex.Message); } } protected override async Task OnInitializedAsync() { await SetPageHeader(L("Expenses")); //await GetCareEventInfo(); await GetList(); } private async Task GetList() { await SetBusyAsync(async () => { await WebRequestExecuter.Execute( async () => await _expensesAppService.GetActiveForUser(), (result) => { pendingExpenses.Clear(); approvedExpenses.Clear(); deniedExpenses.Clear(); foreach (var exp in result.Items) { if (exp.Expense.ApprovalStatus == Enums.CareEventStatuses.Pending) { ExpenseListModel expense = new ExpenseListModel() { Amount = exp.Expense.Amount, Payee = exp.Expense.Payee, ExpenseType = exp.Expense.ExpenseType, ReceivedDate = exp.Expense.ReceivedDate }; pendingExpenses.Add(expense); } else if (exp.Expense.ApprovalStatus == Enums.CareEventStatuses.Approved) { ExpenseListModel expense = new ExpenseListModel() { Amount = exp.Expense.Amount, Payee = exp.Expense.Payee, ExpenseType = exp.Expense.ExpenseType, ReceivedDate = exp.Expense.ReceivedDate }; approvedExpenses.Add(expense); } else { ExpenseListModel expense = new ExpenseListModel() { Amount = exp.Expense.Amount, Payee = exp.Expense.Payee, ExpenseType = exp.Expense.ExpenseType, ReceivedDate = exp.Expense.ReceivedDate }; deniedExpenses.Add(expense); } } return Task.CompletedTask; }); }); } }
}
using System; using Abp.AutoMapper; using simul_bcfo.Expenses.Dtos;
namespace simul_bcfo.Mobile.MAUI.Models.Expenses { [AutoMapFrom(typeof(ExpenseDto))] public class ExpenseListModel : ExpenseDto { public ExpenseListModel() { } public string AmountAsString { get { return Amount.ToString("$#,##0.00"); } } } } using simul_bcfo.Enums;
using System; using Abp.Application.Services.Dto; using Abp.Domain.Entities;
namespace simul_bcfo.Expenses.Dtos { public class ExpenseDto : EntityDto<Guid> { public decimal Amount { get; set; }
public DateTime ReceivedDate { get; set; } public string CheckNumber { get; set; } public string ConfirmationNumber { get; set; } public string PaymentSequence { get; set; } public CareEventStatuses ApprovalStatus { get; set; } public string Note { get; set; } public Guid? PayeeId { get; set; } public Guid? ExpenseTypeId { get; set; } public Guid? PaymentMethodId { get; set; } public Guid PatientId { get; set; } public Guid CareEventId { get; set; } public long? SubmitterId { get; set; } public string CareEventTitle { get; set; } public string Payee { get; set; } public string ExpenseType { get; set; } }
}
Here are the classes I added.
I tried it with JetBrains Rider and got the same result.
-
0
Hi @drutter1954,
It seems a post method. Not get method.
Task<PagedResultDto<GetExpenseForViewDto>> GetActiveForPatient(GetAllExpensesInput input);
Please use
ApiClient.PostAsync
method for the request that contains input. -
0
I changed the method to a PostAsync but that doesn't make any difference because it never even gets to the call.
I am getting errors in the compile stating that several of the classes in the Core.Shared project are not able to be resolved. Also when I attempt to debug the app, I get messages that the proxies source files cannot be found. There is something wrong with the environment, solution or something that I cannot find the cause for.
Again even starting from scratch I cannot add in anything that resolves at runtime. IF you can tell me how to share my project with you I will be glad to do so. I have used your framework in the past and been happy with the results. This time I am at my wits end trying to get the simplest things to work.
-
0
Hi @drutter1954,
First, you can delete bin obj and node_modules folders. Then, zip your project and upload it to Gdrive or whatever you want. And share the link with [email protected] (You can also send with WeTransfer)
-
0
Good morning. I sent you the link to my solution last week. Have you received the solution and have you gotten it to work? Can you please update me on your progress?
-
0
Hi @drutter1954,
The e-mail you sent did not reach me. Could you recheck the email?
Also maybe a screenshot of the mail.
-
0
-
0
Hi @drutter1954,
I request access to the drive file. [email protected]
-
0
Hi @drutter1954,
I checked your project and there are errors. See screenshot
After solving these open
AddExpenseModal.razor.cs
Change line 28 to the following code because of the Object reference null problem.
protected CreateOrEditExpenseModalViewModel Expense = new CreateOrEditExpenseModalViewModel() { Expense = new CreateOrEditExpenseDto() };
After making these changes, it successfully sends a request to the server. I did not find any errors regarding the errors you received. Try again on another computer. Or try formatting the computer. Those errors are not related to aspnetzero.
-
0
How did you resolve the errors?? The items that are unresolved are the classes that are part of the base framework. That is the issue that I have been fighting and do not know how to get them resolved.
-
0
Open
ExcelImportControllerBase.cs
and fixAbpWebConsts.LocalizationSourceName
it wasAbpWebConsts.LocalizaionSourceName
Open
AbpUserLocalizationConfigDtoExtensions.cs
and fixsimul_bcfoConsts.LocalizationSourceName
it wassimul_bcfoConstants.LocalizationSourceName
These were just the problems I experienced. And as I mentioned above open
AddExpenseModal.razor.cs
Change line 28 to the following code because of the Object reference null problem.
protected CreateOrEditExpenseModalViewModel Expense = new CreateOrEditExpenseModalViewModel() { Expense = new CreateOrEditExpenseDto() };
After making these changes, it successfully sends a request to the server.
-
0
Both of those files are generated from AspNetZero's framework. Can you please fix it in the generation process? I have fixed it in my local code. Thanks for finding it.
-
0
I'm glad your problem was solved. We will fix the bugs in the next version.