Handling errors properly is essential in building a robust application in Angular. Error handlers provide an opportunity to present friendly information to the user and collect important data for development. In today’s age of advanced front-end websites, it’s more important than ever to have an effective client-side solution for error handling.
An application that does not handle errors gracefully leaves its users confused and frustrated when the app suddenly breaks without explanation. Handling these errors correctly across an application greatly improves user experience. Collected data from the error handling can inform the development team about important issues that slipped past testing. This is why monitoring tools like Rollbar are so important.
In this article, we will compare several solutions for error handling in Angular apps. First, we will describe the traditional approaches using
HttpClient. Then, we will show you a better solution using
HttpInterceptor. We’ll also show you how to use this interceptor to monitor and track errors centrally in Rollbar.
Source: Error Handling with Angular 8 – Tips and Best Practices
Got this error when building a .NET framework (version 4.6.1) solution containing multiple projects:
The type 'HttpResponseMessage' exists in both 'System.Net.Http, Version=188.8.131.52, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System.Net.Http, Version=184.108.40.206, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
Install System.Net.Http version 4.0.0 as nuget package to the “failing project”.
Added this to the “failing” project app.config file:
<!-- other dependentAssembly bindings here -->
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-220.127.116.11" newVersion="18.104.22.168" />
Updated the “failing” projects .csproj file like this:
Removed this line or similar for System.Net.Http:
<!--<Reference Include="System.Net.Http, Version=22.214.171.124, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />-->
Added “hintpath” with projects relative path to the nuget packages.
In my example its 3 level up and then down (..\..\..) you might need to adjust to your projects folderstructure.
<Reference Include="System.Net.Http, Version=4.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
Error message in Jetbrains Webstorm:
Waiting for connection to localhost:59066. Please ensure that the browser was started successfully with remote debugging port opened. Port cannot be opened if Chrome having the same User Data Directory is already launched.
Can be fixed by installing the “jetbrains ide” chrome extension and make sure the above settings checkbox is active “Use JetBrains IDE support extension…”
After adding a new 3rd party reference to a project and then building for Release configuration I got this error (not present when in debug build):
Error Could not load file or assembly ‘x’ or one of its dependencies. The system cannot find the file specified. SGEN
Here is a solution that worked for me:
If you are having this problem while building your VS.NET project in Release mode here is the solution: Go to the project properties and click on the Build tab and set the value of the “Generate Serialization Assembly” dropdown to “Off”. Sgen.exe is “The XML Serializer Generator creates an XML serialization assembly for types in a specified assembly in order to improve the startup performance of a XmlSerializer when it serializes or deserializes objects of the specified types.” (MSDN)
Source: c# – sgen.exe fails during build – Stack Overflow
I have upgraded a site from EPiServer 7.5 to 11.8.
When deploying the upgraded site to the test environment the edit and admin interface stopped working (the top episerver ui menu visible but lots of js errors and no “main edit window visible” and entire admin mode 404 not found).
The problem was related to some old config for “ProtectedAddons”, i just commented the below config in web.config on test server and the edit and admin mode works again.
(comment out/remove below from web.config)
<add name="ProtectedAddons" virtualPath="~/epi/" physicalPath="[appDataPath]\Modules" type="EPiServer.Web.Hosting.VirtualPathNonUnifiedProvider, EPiServer.Framework.AspNet" />
Inspiration for the solution came from here: Object reference error in initialization modules
when I change the targetting from .net 4.6.1 to .net 4.7 . I get this error when build , but there is no project .json , how can I pass this? project cannot compile now. Severity Code Description Project File Line Suppression State Error ` Your project is not referencing the “.NETFramework,Version=v4.7” framework. Add a reference to “.NETFramework,Version=v4.7” in the “frameworks” section of your project.json, and then re-run NuGet restore.
/obj and rebuild your solution.
Source: change a .net 4.6.1 project to .net 4.7 failed – Stack Overflow
Razor views are dynamically compiled by the ASP.NET runtime. If you want your views to be built at compile-time you could add the following option to your .csproj file:
You may take a look at the this article for more details.
Source: asp.net mvc – razor views are not giving compile time error – Stack Overflow
Upgrading EPiServer 8 to 9 might result in this warning:
Warning CS0618 ‘PermanentLinkMapStore.TryToMapped(string, out string)’ is obsolete: ‘This method only supports classic/mapped url’s which are no longer used since 8.0 – use PermanentLinkUtility.GetGuid(url) to get the unique ID from an URL’
How to solve warning:
You can try:
to get a permanent link
See more info here: PermanentLinkMapStore.TryToMapped and PermanentLinkUtility.GetContentReference not working after EPiServer 9 Upgrade
I’m getting, “Could not load file or assembly ‘Bla’ or one of its dependencies. An attempt was made to load a program with an incorrect format.”
Source: registry – How can I enable Assembly binding logging? – Stack Overflow