Activities of "RonaldR"

no, we cant. in the web module, which only runs on startup public override void ConfigureServices(ServiceConfigurationContext context)

we create the filter and add it to the filter stack, as stated above: context.Services.AddMvc(options => options.Filters.Add(new TrackPerformanceFilter(connStr, configuration)));

so when the class is instastiated, it is start up, not at the time the controller is invoked, so we dont know the tenant, plus, it is only created once, there is no option to do DI in to the filter

no, that didnt solve it. i updated to 4.2.0, then i changed the resolved:

namespace DAG.TFORM.Web.Resolvers
{
    [Dependency(ReplaceServices = true)]
    public class TFORMMultiTenantConnectionStringResolver : MultiTenantConnectionStringResolver
    {
        public TFORMMultiTenantConnectionStringResolver(
            IOptionsSnapshot<AbpDbConnectionOptions> options,
            ICurrentTenant currentTenant,
            IServiceProvider serviceProvider) : base(options, currentTenant, serviceProvider)
        {
        }

        public override async Task<string> ResolveAsync(string connectionStringName = null)
        {
            string connectionString = string.Empty;

            try
            {
                connectionString = await base.ResolveAsync(connectionStringName);
            }
            catch
            {
                return connectionString;
            }

            return string.IsNullOrEmpty(connectionString) ? connectionString : EncryptionHelper.Decrypt(connectionString);
        }
    }
}

But when i try to runit i still get this error:

An unhandled exception occurred while processing the request. ArgumentException: Format of the initialization string does not conform to specification starting at index 0. System.Data.Common.DbConnectionOptions.GetKeyValuePair(string connectionString, int currentPosition, StringBuilder buffer, bool useOdbcRules, out string keyname, out string keyvalue)

ArgumentException: Format of the initialization string does not conform to specification starting at index 0. System.Data.Common.DbConnectionOptions.GetKeyValuePair(string connectionString, int currentPosition, StringBuilder buffer, bool useOdbcRules, out string keyname, out string keyvalue) System.Data.Common.DbConnectionOptions.ParseInternal(Dictionary<string, string> parsetable, string connectionString, bool buildChain, Dictionary<string, string> synonyms, bool firstKey) System.Data.Common.DbConnectionOptions..ctor(string connectionString, Dictionary<string, string> synonyms, bool useOdbcRules) System.Data.Common.DbConnectionStringBuilder.set_ConnectionString(string value) Npgsql.NpgsqlConnectionStringBuilder..ctor(string connectionString) Npgsql.NpgsqlConnection.GetPoolAndSettings() Npgsql.NpgsqlConnection.set_ConnectionString(string value) Npgsql.NpgsqlConnection..ctor(string connectionString) Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlRelationalConnection.CreateDbConnection() Microsoft.EntityFrameworkCore.Storage.RelationalConnection.get_DbConnection() Microsoft.EntityFrameworkCore.Storage.RelationalCommand.CreateDbCommand(RelationalCommandParameterObject parameterObject, Guid commandId, DbCommandMethod commandMethod) Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable<T>+AsyncEnumerator.InitializeReaderAsync(DbContext _, bool result, CancellationToken cancellationToken) Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecutionStrategy.ExecuteAsync<TState, TResult>(TState state, Func<DbContext, TState, CancellationToken, Task<TResult>> operation, Func<DbContext, TState, CancellationToken, Task<ExecutionResult<TResult>>> verifySucceeded, CancellationToken cancellationToken) Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable<T>+AsyncEnumerator.MoveNextAsync() Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync<TSource>(IQueryable<TSource> source, CancellationToken cancellationToken) Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync<TSource>(IQueryable<TSource> source, CancellationToken cancellationToken) Volo.Abp.LanguageManagement.EntityFrameworkCore.EfCoreLanguageRepository.GetListAsync(bool isEnabled) Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous<TResult>(IInvocation invocation, IInvocationProceedInfo proceedInfo) Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue<TResult>.ProceedAsync() Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter<TInterceptor>.InterceptAsync<TResult>(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func<IInvocation, IInvocationProceedInfo, Task<TResult>> proceed) Volo.Abp.LanguageManagement.DatabaseLanguageProvider.MBFPd5o9y() Volo.Abp.Caching.DistributedCache<TCacheItem, TCacheKey>.GetOrAddAsync(TCacheKey key, Func<Task<TCacheItem>> factory, Func<DistributedCacheEntryOptions> optionsFactory, Nullable<bool> hideErrors, bool considerUow, CancellationToken token) Volo.Abp.LanguageManagement.DatabaseLanguageProvider.GetLanguagesAsync() Microsoft.AspNetCore.RequestLocalization.DefaultAbpRequestLocalizationOptionsProvider.GetLocalizationOptionsAsync() Microsoft.AspNetCore.RequestLocalization.AbpRequestLocalizationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+<>c__DisplayClass6_1+<<UseMiddlewareInterface>b__1>d.MoveNext() Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

we are having another resolver issue. when we tried to upgrade from 4.1.2 to 4.2.0 we started getting connection string issues. below is a screenshot of the error when we run. out connection string is encrypted. we have a resolver to decrypt it. it look to me as if there is somewhere we need to add a decryption somewhere that is not being covered by the resolver. thoughts?

our development cycle ends this coming week and i will have the time to put together the demo for that issue

I suspected it had to do with unit of work, but we arent tagging these functions as [UnitOfWork]. it is implicit in v4?

so in the functions i want to make sure are outside the scope of their clling fucntions i need to wrap them in their own unit of work?

thanks

More information: i can repeat it fairly regularly when i am running multiple jobs simultaneously from hangfire.

hope that helps

Here is the whole error stack trace

" at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable1.Enumerator.Dispose()\r\n at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable1 source)\r\n at Castle.Proxies.Invocations.ITenantRepository_FindById.InvokeMethodOnTarget()\r\n at Castle.DynamicProxy.AbstractInvocation.Proceed()\r\n at Castle.DynamicProxy.AbstractInvocation.ProceedInfo.Invoke()\r\n at Castle.DynamicProxy.AsyncInterceptorBase.ProceedSynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.<ProceedAsync>d__7.MoveNext()\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Volo.Abp.Uow.UnitOfWorkInterceptor.<InterceptAsync>d__3.MoveNext()\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.<InterceptAsync>d__31.MoveNext()\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at Castle.DynamicProxy.NoCoverage.RethrowHelper.Rethrow(Exception exception)\r\n at Castle.DynamicProxy.NoCoverage.RethrowHelper.RethrowInnerIfAggregate(Exception exception)\r\n at Castle.DynamicProxy.AsyncInterceptorBase.InterceptSynchronousResult[TResult](AsyncInterceptorBase me, IInvocation invocation)\r\n at Castle.DynamicProxy.AbstractInvocation.Proceed()\r\n at Castle.Proxies.IBasicRepository1Proxy_12.FindById(Guid id, Boolean includeDetails)\r\n at Volo.Saas.Tenants.TenantStore.Find(Guid id)\r\n at Volo.Abp.MultiTenancy.MultiTenantConnectionStringResolver.Resolve(String connectionStringName)\r\n at DAG.TFORM.Web.Resolvers.TFORMMultiTenantConnectionStringResolver.Resolve(String connectionStringName) in C:\Users\ronald.rizk\source\repos\tform_repo\DAG.TFORM\aspnet-core\src\DAG.TFORM.Web\Resolvers\TFORMMultiTenantConnectionStringResolver.cs:line 27"

That line 27 is the line of code i identified above: var connectionString = base.Resolve(connectionStringName);

public async Task LinuxNetstatsDiscovery(string TaskName, Guid? TenantId)
{

	DateTime nowDt = DateTime.UtcNow;
	List<string> failedIpAddesses = new List<string>();

	using (CurrentTenant.Change(TenantId))
	{
		var sourceOfTruthNewDevices = new List<SourceOfTruthDataModel>();
**This class function is defined below	**	
		Guid BgjID = await _helperRepository.CreateBackgroundJobProcessingRecord(TenantId, $"{OperatingSystemEnum.Names.Linux} {DiscoveryType} Discovery");
		List<HostListItemModel> hosts = await _helperRepository.GetHostList(TenantId, OperatingSystemEnum.OperatingSystem.Linux);

		try
		{
			foreach (var host in hosts)
			{
				... do our processing ...
				add record to DbContenxt.MyTable(record);
			}

			await _helperRepository.UpdateBackgroundJobStatusSuccess(BgjID, failedIpAddesses);
			await DbContext.SaveChangesAsync();
		}
		catch (Exception ex)
		{
			//DbContext.Reset();
			LogException(ex);
			await _helperRepository.UpdateBackgroundJobStatusError(BgjID, failedIpAddesses);
			throw;
		}
	}
}

public async Task<Guid> CreateBackgroundJobProcessingRecord(Guid? tenantId, string jobName)
{
	BackgroundJobDataModel jobDetails = new BackgroundJobDataModel(_guidGenerator.Create())
	{
		StartTime = DateTime.UtcNow,
		TenantId = tenantId,
		JobName = jobName,

		Status = "Processing"
	};

	jobDetails.EndTime = jobDetails.StartTime;

**_backgroundRepository is an IRepositry that is dependancy injected in the consturctor**
	await _backgroundRepository.InsertAsync(jobDetails, true);
	await _backgroundRepository.GetDbContext().SaveChangesAsync();

	return jobDetails.Id;
}

so even though i save changes in this function, it does not unless i hit the save changes at the bottom of my loop

i have no way to create the issue on demand, it just sort of happens some times, here is a screenshot of the code along with the error. not that it should matter, but the connectionStringName is not null, but null should be a valid option for it

https://gyazo.com/e1c07cce38a2e189cef5e7c4e4445639

i already do that, if the string being returned from the Base.resolver is empty i just return string.empty. should it be null instead? that being said, thats not the line that fails, i am getting the exception on the call to base.resolver trying to get the connection string so i can test its value.

Showing 11 to 20 of 32 entries
Made with ❤️ on ABP v9.0.0-preview Updated on September 19, 2024, 10:13