For some reason all my EF Core repository tests are failing (like https://github.com/abpframework/abp/issues/10822) with the following exception
Volo.Abp.AbpInitializationException : An error occurred during the initialize Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor phase of the module Beinni.BeinniTestBaseModule, Beinni.TestBase, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: String reference not set to an instance of a String. (Parameter 's'). See the inner exception for details.
---- System.ArgumentNullException : String reference not set to an instance of a String. (Parameter 's')
And that is after I had to add the following code in TestBaseModule as recommended after I started getting SqliteConnection does not support nested transactions.
.
Configure<AbpUnitOfWorkDefaultOptions>(options =>
{
options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled;
});`
I also tried this this approach but still this ""String reference.. " error.
And its not this either.
I have re-compared everything and there aren´t any changes in the test projects that I'm missing.
Any ideas?
The full stack trace is this
Stack Trace: ModuleManager.InitializeModules(ApplicationInitializationContext context) AbpApplicationBase.InitializeModules() AbpApplicationWithExternalServiceProvider.Initialize(IServiceProvider serviceProvider) AbpIntegratedTest
1.ctor()
BeinniTestBase1.ctor() BeinniEntityFrameworkCoreTestBase.ctor() BankInformationRepositoryTests.ctor() line 15 RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions) ----- Inner Stack Trace ----- Encoding.GetBytes(String s) UserCustomerSyncronizer.Sign(String method, String urlPath, String salt, Int64 timestamp, String body) line 111 UserCustomerSyncronizer.MakeRequestAsync(Method method, String urlPath, String body) line 80 UserCustomerSyncronizer.HandleEventAsync(EntityCreatedEto
1 eventData) line 42
EventBusBase.TriggerHandlerAsync(IEventHandlerFactory asyncHandlerFactory, Type eventType, Object eventData, List1 exceptions, InboxConfig inboxConfig) AbpExceptionExtensions.ReThrow(Exception exception) EventBusBase.ThrowOriginalExceptions(Type eventType, List
1 exceptions)
EventBusBase.TriggerHandlersAsync(Type eventType, Object eventData)
LocalEventBus.PublishAsync(LocalEventMessage localEventMessage)
LocalEventBus.PublishToEventBusAsync(Type eventType, Object eventData)
EventBusBase.PublishAsync(Type eventType, Object eventData, Boolean onUnitOfWorkComplete)
UnitOfWorkEventPublisher.PublishDistributedEventsAsync(IEnumerable1 distributedEvents) UnitOfWork.CompleteAsync(CancellationToken cancellationToken) UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) CastleAsyncAbpInterceptorAdapter
1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) <<SeedTestData>b__0>d.MoveNext() line 62 --- End of stack trace from previous location --- TaskExtensions.WaitAndUnwrapException(Task task) <>c__DisplayClass15_0.<Run>b__0(Task t) ContinuationTaskFromTask.InnerInvoke() <.cctor>b__272_0(Object obj) ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) --- End of stack trace from previous location --- TaskExtensions.WaitAndUnwrapException(Task task) AsyncContext.Run(Func
1 action)
AsyncHelper.RunSync(Func1 action) BeinniTestBaseModule.SeedTestData(ApplicationInitializationContext context) line 58 BeinniTestBaseModule.OnApplicationInitialization(ApplicationInitializationContext context) line 53 OnApplicationInitializationModuleLifecycleContributor.Initialize(ApplicationInitializationContext context, IAbpModule module) ModuleManager.InitializeModules(ApplicationInitializationContext context)
Suite is now forcing me to remove TenantId column in a none multitenant table (doesn´t inherit from IMultiTenant)!
Invalid property names! You need to remove the following properties which are reserved properties and come with ABP base classes: TenantId
The thing is I need that column (I'm currently using it) to know what tenant created the record in that table.
The content is available for every other tenant on a central index page (showing stuff from all tenants) and then also used to display just what the individual tenant created on their subdomain page.
Why do you need to restrict this?
And what do you recommend here?
OK I found out what is stripping the headers away
WithAbpExposedHeaders()
if I swap that out with
WithExposedHeaders("*")
I get all the headers.
But what does that mean and is that a viable sultion?
Ok I found an issue talking about this here
.. in the Blazor WASM application, there is no need to use cookies for authentication. So browser cross origins, headers are removed, and the response headers are not returned in the success event.
and then says
As a result, we recommend calling the AllowCredentials() method, as shown in the code snippet below, to allow header configuration in the startup page.
But my ConfigureCors() is just the same (similar)
But something must be stripping out the headers so any idea?
Ok didn’t see it because I was just looking at the response in code. Then the method Im using there to get the headers is not a good one (just using Syncfusion code example)
One more related question, how can I add custom header to the response?
This doesn't work in the controller
Response.Headers.Add("BlobName", "content");
but I can still manipulate the response like with Response.ContentType = "THIS IS RETURNED!!"
public virtual async Task Save(IList<IRemoteStreamContent> UploadRecording)
{
try
{
Response.Headers.Add("CustomHeader", "someContent"); //<-- Isn´t returned!
Response.ContentType = "THIS IS RETURNED!!"; //<-- BUT this is!
}
catch (Exception e)
{
Response.Clear();
Response.StatusCode = 204;
Response.HttpContext.Features.Get<IHttpResponseFeature>().ReasonPhrase = "File failed to upload";
Response.HttpContext.Features.Get<IHttpResponseFeature>().ReasonPhrase = e.Message;
}
}
Here in Blazor I'm trying to get the response back when successfully uploaded a file to the controller.
I'm just going after the Syncfusion example so there must be something else I need to do ?
I needed (I think) to add the following web.config to the HttpApi.Host project to increase upload size with the following config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!-- To customize the asp.net core module uncomment and edit the following section.
For more info see https://go.microsoft.com/fwlink/?linkid=838655 -->
<!--
<system.webServer>
<handlers>
<remove name="aspNetCore"/>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
-->
<location path="Recording/recording-upload">
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="4096000" />
</requestFiltering>
</security>
</system.webServer>
</location>
</configuration>
And then I get this error when running the app with Azure Appservice
2021-12-21 13:54:57.472 +00:00 [ERR] Connection ID "17509995361417066312", Request ID "80007749-0002-f300-b63f-84710c7967bb": An unhandled exception was thrown by the application.
Volo.Abp.Http.Client.AbpRemoteCallException: Not Found
at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase`1.ThrowExceptionForResponseAsync(HttpResponseMessage response)
at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase`1.RequestAsync(ClientProxyRequestContext requestContext)
at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase`1.RequestAsync[T](ClientProxyRequestContext requestContext)
at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase`1.RequestAsync[T](String methodName, ClientProxyRequestTypeValue arguments)
at Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ClientProxies.AbpApplicationConfigurationClientProxy.GetAsync()
at Volo.Abp.AspNetCore.Mvc.Client.MvcCachedApplicationConfigurationClient.<GetAsync>b__14_0()
at Volo.Abp.Caching.DistributedCache`2.GetOrAddAsync(TCacheKey key, Func`1 factory, Func`1 optionsFactory, Nullable`1 hideErrors, Boolean considerUow, CancellationToken token)
at Volo.Abp.AspNetCore.Mvc.Client.MvcCachedApplicationConfigurationClient.GetAsync()
at Volo.Abp.AspNetCore.Mvc.Client.RemoteLanguageProvider.GetLanguagesAsync()
at Microsoft.AspNetCore.RequestLocalization.DefaultAbpRequestLocalizationOptionsProvider.GetLocalizationOptionsAsync()
at Microsoft.AspNetCore.RequestLocalization.AbpRequestLocalizationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContextOfT`1.ProcessRequestAsync()
I haven't tried to upload a bigger file than 30 MB but if that doesn´t work without the web.config file I´ll need some way to add it. But I´ll try that tomorrow.