Blazor linking error: Value cannot be null. (Parameter 'input') - c#

I have spent some weeks to create a prototype for my customer using the Blazor Webassembly hosting model. It has worked far above my expectations. Until now. Time for first deployment to real environment on Azure. I have configured PublishTrimmed=true in client and server project files. Is that needed in both projects?
Unfortunately the publish failed on the linking giving me these two errors:
"Optimizing assemblies for size failed. Optimization can be disabled by setting the PublishTrimmed property to false."
"IL Linker has encountered an unexpected error. Please report the issue at https://github.com/mono/linker/issues"
In the dialog I am referred to a tmp file having this content:
"System.AggregateException: One or more errors occurred. ---> Microsoft.WebTools.Shared.Exceptions.WebToolsException: Build failed. Check the Output window for more details.
--- End of inner exception stack trace ---
---> (Inner Exception #0) Microsoft.WebTools.Shared.Exceptions.WebToolsException: Build failed. Check the Output window for more details.<---
Microsoft.WebTools.Shared.Exceptions.WebToolsException: Build failed. Check the Output window for more details."
The output window includes this section:
Fatal error in IL Linker
Unhandled exception. System.ArgumentNullException: Value cannot be null. (Parameter 'input')
at System.Text.RegularExpressions.ThrowHelper.ThrowArgumentNullException(ExceptionArgument arg)
at System.Text.RegularExpressions.Regex.Matches(String input)
at Mono.Linker.Steps.MarkStep.MarkTypeWithDebuggerDisplayAttribute(TypeDefinition type, CustomAttribute attribute)
at Mono.Linker.Steps.MarkStep.MarkTypeSpecialCustomAttributes(TypeDefinition type)
at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference, DependencyInfo reason, IMemberDefinition sourceLocationMember)
at Mono.Linker.Steps.MarkStep.MarkField(FieldDefinition field, DependencyInfo& reason)
at Mono.Linker.Steps.MarkStep.MarkEntireTypeInternal(TypeDefinition type, Boolean includeBaseTypes, DependencyInfo& reason, IMemberDefinition sourceLocationMember, HashSet1 typesAlreadyVisited) at Mono.Linker.Steps.MarkStep.MarkEntireTypeInternal(TypeDefinition type, Boolean includeBaseTypes, DependencyInfo& reason, IMemberDefinition sourceLocationMember, HashSet1 typesAlreadyVisited)
at Mono.Linker.Steps.MarkStep.MarkEntireAssembly(AssemblyDefinition assembly)
at Mono.Linker.Steps.MarkStep.InitializeAssembly(AssemblyDefinition assembly)
at Mono.Linker.Steps.MarkStep.Initialize()
at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
at Mono.Linker.Pipeline.Process(LinkContext context)
at Mono.Linker.Driver.Run(ILogger customLogger)
at Mono.Linker.Driver.Main(String[] args)
What can I do? I have really recommended Blazor to my colleagues. I would be ashamed to tell them we need to skip the trimming and publish an application that will give the customers a download size of 9 MB!!!!
Is the trimming just an empty promise or does it actually work in real applications? Can I do something to detect the crucial problem? The error hints are not really helpful. I don't mind reporting an issue, but I have no meaningful details to include in the report.

Related

Azure - Web Deployment Task Failed [System.AggregateException - WebToolsException] ERROR_COULD_NOT_CONNECT_TO_REMOTESVC

Unable to deploy to Azure App Service. What might be possibly going wrong here?
10-10-2021 11:07:06
System.AggregateException: One or more errors occurred. ---> Microsoft.WebTools.Shared.Exceptions.WebToolsException: Build failed. Check the Output window for more details.
--- End of inner exception stack trace ---
---> (Inner Exception #0) Microsoft.WebTools.Shared.Exceptions.WebToolsException: Build failed. Check the Output window for more details.<---
Microsoft.WebTools.Shared.Exceptions.WebToolsException: Build failed. Check the Output window for more details.
===================
I'm using Visual studio 2022 Preview.
I tried this solution earlier, but this didn't work in my case, this was actually due to partially deleted publish profile under the properties folder.
So completely clearing (leaving launchSettings.json intact) that and adding profile again helped me resolve this issue.

Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA2006

I'm trying to release a Xamarin.Forms application, but when I change to release in the configuration for the Android project and build I get the following error:
Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA2006: Could not resolve reference to 'System.Int32 Xamarin.Forms.Platform.Resource/String::ApplicationName' (defined in assembly 'Syncfusion.SfChart.XForms.Android, Version=13.2451.0.29, Culture=neutral, PublicKeyToken=null') with scope 'Xamarin.Forms.Platform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. When the scope is different from the defining assembly, it usually means that the type is forwarded. ---> Mono.Cecil.ResolutionException: Failed to resolve System.Int32 Xamarin.Forms.Platform.Resource/String::ApplicationName
at Mono.Linker.Steps.MarkStep.MarkField(FieldReference reference)
at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction)
at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
at Mono.Linker.Steps.MarkStep.ProcessQueue()
at Mono.Linker.Steps.MarkStep.Process()
at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
at MonoDroid.Tuner.MonoDroidMarkStep.Process(LinkContext context)
at Mono.Linker.Pipeline.Process(LinkContext context)
at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context)
at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
--- End of inner exception stack trace ---
at Java.Interop.Tools.Diagnostics.Diagnostic.Error(Int32 code, Exception innerException, String message, Object[] args)
at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
at Xamarin.Android.Tasks.LinkAssemblies.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() XamarinCRM.Android
The same error message occurred with me. I was able to solve it like this:
Right-click the Android Project > Properties > Android Options > Linker, and then choose the "None" option in the Linking property.
We suspect that there are some version conflicts between Syncfusion/Xamarin.Forms assemblies and we kindly request you to follow the below steps.
Update your Essential Studio for Xamarin to latest version (15.1.0.41) which can be downloaded from the following location.
Link: https://www.syncfusion.com/downloads/version-history/15_1_0_41
Update your Xamarin.Forms version to 2.3.3.180.
Please get back to us if you are still facing any issues.

PostSharp OutOfMemoryException during Visual Studio build

I'm using the latest version of PostSharp (version 4.1.31.0) in a C# solution with Visual Studio 2015 (with update 1).
Everytime I try to build the solution I get the following error:
Unhandled exception (4.1.31.0, postsharp.srv.4.0-x86.exe, CLR 4.0.30319.394271, Release): System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
I've switched on detailed output when building but haven't been able to spot anything in the output so far!
I have other solutions that work fine with this version so I suspect it is something to do with the solution's configuration.
As an aside, I have also tried version 4.1.30 and get exactly the same error.
Any help or advice on where to look would be greatly appreciated.
So to solve my issue all I had to do was to set the PostSharp 'Processor Architecture' option in the project properties to x64 for the project that includes my aspects.
I'm not exactly sure why but my application builds and runs without issues.
Had the same issue, PostSharp crashing at compile time:
Severity Code Description Project File Line Suppression State
Error An unexpected exception occurred when executing user code: System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
at System.Reflection.RuntimeMethodInfo.FetchNonReturnParameters()
at System.Reflection.RuntimeMethodInfo.GetParameters()
at PostSharp.Patterns.Model.NotifyPropertyChanged.DependencyAnalysis.InpcMemberAnalysis.IsInpcIgnoredProperty(PropertyInfo property)
at PostSharp.Patterns.Model.NotifyPropertyChangedAttribute.<>c.<GetNotifiableProperties>b__48_0(PropertyInfo p)
at System.Linq.Enumerable.WhereArrayIterator`1.MoveNext()
at PostSharp.Patterns.Model.NotifyPropertyChangedAttribute.GetNotifiableProperties(Type type, Boolean excludeExplicitProperties, Boolean& hasExplicitProperties)
at PostSharp.Patterns.Model.NotifyPropertyChangedAttribute.CompileTimeInitialize(Type type, AspectInfo aspectInfo)
at PostSharp.Sdk.AspectWeaver.AspectWeavers.TypeLevelAspectWeaverInstance.^gAHJKdyo.^WnalpwzH()
at PostSharp.Sdk.Utilities.ExceptionHelper.ExecuteUserCode(MessageLocation messageLocation, Action userCode, Type[] acceptableExceptions). Avalon.Dock.Measurements
Solved it by killing the process PostSharp Compile service (something like this) from the task manager.

unable to run react.net in 64-bit mode on iis

I have followed http://reactjs.net/getting-started/tutorial.html to get started with ReactJS.
The first step works fine running in IISExpress. However running the same example in "real" IIS does not work. I Get the following error:
Server Error in '/' Application.
Unable to resolve type: React.Web.IJsxHandler
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: React.TinyIoC.TinyIoCResolutionException: Unable
to resolve type: React.Web.IJsxHandler
Source Error: An unhandled exception was generated during the
execution of the current web request. Information regarding the origin
and location of the exception can be identified using the exception
stack trace below.
Stack Trace: [TinyIoCResolutionException: Unable to resolve type: React.Web.IJsxHandler]
React.TinyIoC.TinyIoCContainer.ResolveInternal(TypeRegistration
registration, NamedParameterOverloads parameters, ResolveOptions
options) +1165 React.TinyIoC.TinyIoCContainer.Resolve() +163
React.Web.JsxHandlerFactory.ProcessRequest(HttpContext context) +52
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+913 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +165
If I set the "Enable 32-bit applications" setting to true in the application pool, the solution starts to work.
Based on this, I guess the problem is related to instantiating the 64-bit react dll (or v8 component).
I have tried installing the x64 run time components (both 2012 and 2013) to no avail.

Error: Compilation Lock when running unit tests

We have over 1000 unit tests. A while ago 18 of them started to fail when they were run together with the other tests. These tests run a windows workflow.
If they are run alone they pass.
The error appears to be that it cannot find the connection string.
It cannot find the connection string because it does not know which config file to look in.
It does not know which config file to look in because it cannot find the application context
And it cannot find the application context due to a compilation lock.
Anybody have any idea what could be wrong, and how to fix this? The error I am getting is:
Message: Exception message: The
supplied connection string is not
valid, because it contains
insufficient mapping or metadata
information. Parameter name:
connectionString Inner exception :
System.InvalidOperationException:
Unable to determine application
context. The ASP.NET application path
could not be resolved. --->
System.Reflection.TargetInvocationException:
Exception has been thrown by the
target of an invocation. --->
System.Web.HttpException: The type
initializer for
'System.Web.Compilation.CompilationLock'
threw an exception. --->
System.TypeInitializationException:
The type initializer for
'System.Web.Compilation.CompilationLock'
threw an exception. --->
System.NullReferenceException: Object
reference not set to an instance of an
object. at
System.Web.Compilation.CompilationLock..cctor()
--- End of inner exception stack trace --- at System.Web.Compilation.CompilationLock.GetLock(Boolean&
gotLock) at
System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled()
Thanks
Shiraz
Since you mention that your tests run a WF workflow, I would guess that a previous test run has one or more workflow instances that still run on a thread somewhere, thus locking the compiler because the assemblies are still loaded in a process somewhere.
Can you open Task Manager and investigate whether there's a running process that still uses the workflow somewhere? If so, kill it and see if you can't compile.

Categories

Resources