mirror of
https://github.com/bitwarden/android.git
synced 2024-12-25 02:18:27 +03:00
[EC-324] Added more logging for information on list crash (#1993)
* EC-324 Added more logging for trying to get more information on list out of range crash on AppCenter * EC-324 Fix include on iOS.Core.csproj on iOS CollectionView files
This commit is contained in:
parent
8f3a4b98a5
commit
1f2fb3f796
4 changed files with 79 additions and 1 deletions
16
src/iOS.Core/Renderers/CollectionView/CollectionException.cs
Normal file
16
src/iOS.Core/Renderers/CollectionView/CollectionException.cs
Normal file
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
namespace Bit.iOS.Core.Renderers.CollectionView
|
||||
{
|
||||
public class CollectionException : Exception
|
||||
{
|
||||
public CollectionException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
|
||||
public CollectionException(string message, Exception innerEx)
|
||||
: base(message, innerEx)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
using System;
|
||||
using Bit.App.Controls;
|
||||
using Bit.Core.Services;
|
||||
using Foundation;
|
||||
using UIKit;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
namespace Bit.iOS.Core.Renderers.CollectionView
|
||||
|
@ -13,6 +15,11 @@ namespace Bit.iOS.Core.Renderers.CollectionView
|
|||
{
|
||||
}
|
||||
|
||||
protected override UICollectionViewDelegateFlowLayout CreateDelegator()
|
||||
{
|
||||
return new ExtendedGroupableItemsViewDelegator<TItemsView, ExtendedGroupableItemsViewController<TItemsView>>(ItemsViewLayout, this);
|
||||
}
|
||||
|
||||
protected override void UpdateTemplatedCell(TemplatedCell cell, NSIndexPath indexPath)
|
||||
{
|
||||
try
|
||||
|
@ -21,7 +28,17 @@ namespace Bit.iOS.Core.Renderers.CollectionView
|
|||
}
|
||||
catch (Exception ex) when (ItemsView?.ExtraDataForLogging != null)
|
||||
{
|
||||
throw new Exception("Error in ExtendedCollectionView, extra data: " + ItemsView.ExtraDataForLogging, ex);
|
||||
var colEx = new CollectionException("Error in ExtendedCollectionView -> ExtendedGroupableItemsViewController, extra data: " + ItemsView.ExtraDataForLogging, ex);
|
||||
try
|
||||
{
|
||||
LoggerHelper.LogEvenIfCantBeResolved(colEx);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Do nothing in here, this is temporary to get more info about the crash, if the logger fails, we want to get the info
|
||||
// by crashing with the original exception and not the logger one
|
||||
}
|
||||
throw colEx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
using System;
|
||||
using Bit.App.Controls;
|
||||
using Bit.Core.Services;
|
||||
using CoreGraphics;
|
||||
using Foundation;
|
||||
using UIKit;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
namespace Bit.iOS.Core.Renderers.CollectionView
|
||||
{
|
||||
public class ExtendedGroupableItemsViewDelegator<TItemsView, TViewController> : GroupableItemsViewDelegator<TItemsView, TViewController>
|
||||
where TItemsView : ExtendedCollectionView
|
||||
where TViewController : GroupableItemsViewController<TItemsView>
|
||||
{
|
||||
public ExtendedGroupableItemsViewDelegator(ItemsViewLayout itemsViewLayout, TViewController itemsViewController)
|
||||
: base(itemsViewLayout, itemsViewController)
|
||||
{
|
||||
}
|
||||
|
||||
public override CGSize GetSizeForItem(UICollectionView collectionView, UICollectionViewLayout layout, NSIndexPath indexPath)
|
||||
{
|
||||
// Added this to get extra information on a crash when getting the size for an item.
|
||||
try
|
||||
{
|
||||
return base.GetSizeForItem(collectionView, layout, indexPath);
|
||||
}
|
||||
catch (Exception ex) when (ViewController?.ItemsView?.ExtraDataForLogging != null)
|
||||
{
|
||||
var colEx = new CollectionException("Error in ExtendedCollectionView -> ExtendedGroupableItemsViewDelegator, extra data: " + ViewController.ItemsView.ExtraDataForLogging, ex);
|
||||
try
|
||||
{
|
||||
LoggerHelper.LogEvenIfCantBeResolved(colEx);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Do nothing in here, this is temporary to get more info about the crash, if the logger fails, we want to get the info
|
||||
// by crashing with the original exception and not the logger one
|
||||
}
|
||||
throw colEx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -201,6 +201,8 @@
|
|||
<Compile Include="Renderers\CollectionView\ExtendedCollectionViewRenderer.cs" />
|
||||
<Compile Include="Renderers\CollectionView\ExtendedGroupableItemsViewController.cs" />
|
||||
<Compile Include="Utilities\UISearchBarExtensions.cs" />
|
||||
<Compile Include="Renderers\CollectionView\CollectionException.cs" />
|
||||
<Compile Include="Renderers\CollectionView\ExtendedGroupableItemsViewDelegator.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\App\App.csproj">
|
||||
|
|
Loading…
Reference in a new issue