diff --git a/.github/templates/common.lib.yml b/.github/templates/common.lib.yml
index 7485d3e9fc..f6dcae2f98 100644
--- a/.github/templates/common.lib.yml
+++ b/.github/templates/common.lib.yml
@@ -104,12 +104,16 @@ with:
shell: bash
run: echo "::set-output name=commit::$(git rev-parse HEAD)"
- name: Setup Vcpkg
+ id: setup-vcpkg
uses: friendlyanon/setup-vcpkg@v1
#@yaml/text-templated-strings
with:
path: wrappers/realm-core/tools/vcpkg/ports
- cache-key: vcpkg-(@= preset @)-${{ hashFiles('./wrappers/realm-core/tools/vcpkg/vcpkg.json') }}-${{ steps.vcpkg_cache_key.outputs.commit }}
- cache-restore-keys: vcpkg-(@= preset @)-
+ cache-key: vcpkg3-(@= preset @)-${{ steps.vcpkg_cache_key.outputs.commit }}-${{ hashFiles('./wrappers/realm-core/tools/vcpkg/vcpkg.json') }}
+ cache-restore-keys: vcpkg3-(@= preset @)-${{ steps.vcpkg_cache_key.outputs.commit }}
+ - name: Refetch vcpkg
+ run: git fetch --unshallow
+ working-directory: wrappers/realm-core/tools/vcpkg/ports
#@ end
#@ def downloadAllArtifacts(conclusion = "completed"):
@@ -194,6 +198,7 @@ with:
name: #@ artifactName
path: #@ "${{ github.workspace }}/" + relPath
retention-days: #@ retentionDays
+ if-no-files-found: error
#@ end
---
#@ def setupDotnet(version = "6.0.x", ifCondition = ""):
diff --git a/.github/workflows/build-packages.yml b/.github/workflows/build-packages.yml
index a3887ece7f..1d4346c9a6 100755
--- a/.github/workflows/build-packages.yml
+++ b/.github/workflows/build-packages.yml
@@ -149,30 +149,35 @@ jobs:
name: Realm.Fody.${{ steps.get-version.outputs.version }}
path: ${{ github.workspace }}/Realm/packages/Realm.Fody.${{ steps.get-version.outputs.version }}.*nupkg
retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }}
+ if-no-files-found: error
- name: Store artifacts for Realm.${{ steps.get-version.outputs.version }}
uses: actions/upload-artifact@v2
with:
name: Realm.${{ steps.get-version.outputs.version }}
path: ${{ github.workspace }}/Realm/packages/Realm.${{ steps.get-version.outputs.version }}.*nupkg
retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }}
+ if-no-files-found: error
- name: Store artifacts for Realm.UnityUtils.${{ steps.get-version.outputs.version }}
uses: actions/upload-artifact@v2
with:
name: Realm.UnityUtils.${{ steps.get-version.outputs.version }}
path: ${{ github.workspace }}/Realm/packages/Realm.UnityUtils.${{ steps.get-version.outputs.version }}.*nupkg
retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }}
+ if-no-files-found: error
- name: Store artifacts for Realm.UnityWeaver.${{ steps.get-version.outputs.version }}
uses: actions/upload-artifact@v2
with:
name: Realm.UnityWeaver.${{ steps.get-version.outputs.version }}
path: ${{ github.workspace }}/Realm/packages/Realm.UnityWeaver.${{ steps.get-version.outputs.version }}.*nupkg
retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }}
+ if-no-files-found: error
- name: Store artifacts for ExtractedChangelog
uses: actions/upload-artifact@v2
with:
name: ExtractedChangelog
path: ${{ github.workspace }}/Realm/Realm/ExtractedChangelog.md
retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }}
+ if-no-files-found: error
- name: Check Docfx cache
id: check-docfx-cache
if: inputs.build-docs
@@ -197,4 +202,5 @@ jobs:
name: Docs.zip
path: ${{ github.workspace }}/Realm/packages/Docs.zip
retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }}
+ if-no-files-found: error
if: inputs.build-docs
diff --git a/.github/workflows/build-unity.yml b/.github/workflows/build-unity.yml
index 70c5790d3c..de3c0c54eb 100755
--- a/.github/workflows/build-unity.yml
+++ b/.github/workflows/build-unity.yml
@@ -51,12 +51,14 @@ jobs:
name: io.realm.unity-${{ inputs.version }}.tgz
path: ${{ github.workspace }}/Realm/Realm.Unity/io.realm.unity-${{ inputs.version }}.tgz
retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }}
+ if-no-files-found: error
- name: Store artifacts for AssetStorePublisher-${{ inputs.version }}
uses: actions/upload-artifact@v2
with:
name: AssetStorePublisher-${{ inputs.version }}
path: ${{ github.workspace }}/Tools/AssetStorePublisher
retention-days: ${{ (github.event_name != 'pull_request' || contains(github.head_ref, 'release')) && 30 || 1 }}
+ if-no-files-found: error
- name: Build Tests
run: dotnet run --project Tools/SetupUnityPackage/ -- tests --realm-package Realm/Realm.Unity/io.realm.unity-${{ inputs.version }}.tgz
- name: Store artifacts for UnityTests
@@ -65,3 +67,4 @@ jobs:
name: UnityTests
path: ${{ github.workspace }}/Tests/Tests.Unity
retention-days: ${{ github.event_name != 'pull_request' && 30 || 1 }}
+ if-no-files-found: error
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
index eb9773a0fc..0a827cce7b 100644
--- a/.github/workflows/codeql.yml
+++ b/.github/workflows/codeql.yml
@@ -38,11 +38,15 @@ jobs:
shell: bash
run: echo "::set-output name=commit::$(git rev-parse HEAD)"
- name: Setup Vcpkg
+ id: setup-vcpkg
uses: friendlyanon/setup-vcpkg@v1
with:
path: wrappers/realm-core/tools/vcpkg/ports
- cache-key: vcpkg-windows-x64-${{ hashFiles('./wrappers/realm-core/tools/vcpkg/vcpkg.json') }}-${{ steps.vcpkg_cache_key.outputs.commit }}
- cache-restore-keys: vcpkg-windows-x64-
+ cache-key: vcpkg3-windows-x64-${{ steps.vcpkg_cache_key.outputs.commit }}-${{ hashFiles('./wrappers/realm-core/tools/vcpkg/vcpkg.json') }}
+ cache-restore-keys: vcpkg3-windows-x64-${{ steps.vcpkg_cache_key.outputs.commit }}
+ - name: Refetch vcpkg
+ run: git fetch --unshallow
+ working-directory: wrappers/realm-core/tools/vcpkg/ports
- name: Build wrappers
run: powershell ./wrappers/build.ps1 Windows -Platforms x64 -Configuration Release
- name: Perform CodeQL Analysis
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index cd152e920b..8343822e8b 100755
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -285,6 +285,7 @@ jobs:
name: dashboard.charts
path: ${{ github.workspace }}/dashboard.charts
retention-days: 30
+ if-no-files-found: error
cleanup-cluster:
uses: ./.github/workflows/cleanup-baas.yml
if: always()
diff --git a/.github/workflows/wrappers.yml b/.github/workflows/wrappers.yml
index f028c2d501..28451a38db 100755
--- a/.github/workflows/wrappers.yml
+++ b/.github/workflows/wrappers.yml
@@ -51,6 +51,7 @@ jobs:
name: wrappers-macos
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
+ if-no-files-found: error
if: matrix.os == 'ubuntu' && steps.check-cache-macos.outputs.cache-hit == 'true'
- run: git clean -fdx
if: matrix.os == 'ubuntu'
@@ -67,6 +68,7 @@ jobs:
name: wrappers-linux
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
+ if-no-files-found: error
if: matrix.os == 'ubuntu' && steps.check-cache-linux.outputs.cache-hit == 'true'
- run: git clean -fdx
if: matrix.os == 'ubuntu'
@@ -83,6 +85,7 @@ jobs:
name: wrappers-ios-Simulator
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
+ if-no-files-found: error
if: matrix.os == 'ubuntu' && steps.check-cache-ios-Simulator.outputs.cache-hit == 'true'
- run: git clean -fdx
if: matrix.os == 'ubuntu'
@@ -99,6 +102,7 @@ jobs:
name: wrappers-ios-Device
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
+ if-no-files-found: error
if: matrix.os == 'ubuntu' && steps.check-cache-ios-Device.outputs.cache-hit == 'true'
- run: git clean -fdx
if: matrix.os == 'ubuntu'
@@ -115,6 +119,7 @@ jobs:
name: wrappers-ios-Catalyst
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
+ if-no-files-found: error
if: matrix.os == 'ubuntu' && steps.check-cache-ios-Catalyst.outputs.cache-hit == 'true'
- run: git clean -fdx
if: matrix.os == 'ubuntu'
@@ -131,6 +136,7 @@ jobs:
name: wrappers-android-armeabi-v7a
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
+ if-no-files-found: error
if: matrix.os == 'ubuntu' && steps.check-cache-android-armeabi-v7a.outputs.cache-hit == 'true'
- run: git clean -fdx
if: matrix.os == 'ubuntu'
@@ -147,6 +153,7 @@ jobs:
name: wrappers-android-arm64-v8a
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
+ if-no-files-found: error
if: matrix.os == 'ubuntu' && steps.check-cache-android-arm64-v8a.outputs.cache-hit == 'true'
- run: git clean -fdx
if: matrix.os == 'ubuntu'
@@ -163,6 +170,7 @@ jobs:
name: wrappers-android-x86
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
+ if-no-files-found: error
if: matrix.os == 'ubuntu' && steps.check-cache-android-x86.outputs.cache-hit == 'true'
- run: git clean -fdx
if: matrix.os == 'ubuntu'
@@ -179,6 +187,7 @@ jobs:
name: wrappers-android-x86_64
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
+ if-no-files-found: error
if: matrix.os == 'ubuntu' && steps.check-cache-android-x86_64.outputs.cache-hit == 'true'
- run: git clean -fdx
if: matrix.os == 'ubuntu'
@@ -195,6 +204,7 @@ jobs:
name: wrappers-windows-Win32
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
+ if-no-files-found: error
if: matrix.os == 'windows' && steps.check-cache-windows-Win32.outputs.cache-hit == 'true'
- run: git clean -fdx
if: matrix.os == 'windows'
@@ -211,6 +221,7 @@ jobs:
name: wrappers-windows-x64
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
+ if-no-files-found: error
if: matrix.os == 'windows' && steps.check-cache-windows-x64.outputs.cache-hit == 'true'
- run: git clean -fdx
if: matrix.os == 'windows'
@@ -227,6 +238,7 @@ jobs:
name: wrappers-windows-ARM64
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
+ if-no-files-found: error
if: matrix.os == 'windows' && steps.check-cache-windows-ARM64.outputs.cache-hit == 'true'
- run: git clean -fdx
if: matrix.os == 'windows'
@@ -243,6 +255,7 @@ jobs:
name: wrappers-windows-uwp-Win32
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
+ if-no-files-found: error
if: matrix.os == 'windows' && steps.check-cache-windows-uwp-Win32.outputs.cache-hit == 'true'
- run: git clean -fdx
if: matrix.os == 'windows'
@@ -259,6 +272,7 @@ jobs:
name: wrappers-windows-uwp-x64
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
+ if-no-files-found: error
if: matrix.os == 'windows' && steps.check-cache-windows-uwp-x64.outputs.cache-hit == 'true'
- run: git clean -fdx
if: matrix.os == 'windows'
@@ -275,6 +289,7 @@ jobs:
name: wrappers-windows-uwp-ARM
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
+ if-no-files-found: error
if: matrix.os == 'windows' && steps.check-cache-windows-uwp-ARM.outputs.cache-hit == 'true'
- run: git clean -fdx
if: matrix.os == 'windows'
@@ -291,6 +306,7 @@ jobs:
name: wrappers-windows-uwp-ARM64
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
+ if-no-files-found: error
if: matrix.os == 'windows' && steps.check-cache-windows-uwp-ARM64.outputs.cache-hit == 'true'
- run: git clean -fdx
if: matrix.os == 'windows'
@@ -322,6 +338,7 @@ jobs:
name: wrappers-macos
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
+ if-no-files-found: error
ios:
runs-on: macos-latest
name: iOS
@@ -355,6 +372,7 @@ jobs:
name: wrappers-ios-${{ matrix.arch }}
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
+ if-no-files-found: error
if: needs.check-cache.outputs.wrappers-ios-Simulator != 'true' || needs.check-cache.outputs.wrappers-ios-Device != 'true' || needs.check-cache.outputs.wrappers-ios-Catalyst != 'true'
linux:
runs-on: ubuntu-latest
@@ -403,6 +421,7 @@ jobs:
name: wrappers-linux
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
+ if-no-files-found: error
android:
runs-on: ubuntu-20.04
name: Android
@@ -437,6 +456,7 @@ jobs:
name: wrappers-android-${{ matrix.arch }}
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
+ if-no-files-found: error
if: needs.check-cache.outputs.wrappers-android-armeabi-v7a != 'true' || needs.check-cache.outputs.wrappers-android-arm64-v8a != 'true' || needs.check-cache.outputs.wrappers-android-x86 != 'true' || needs.check-cache.outputs.wrappers-android-x86_64 != 'true'
windows:
runs-on: windows-latest
@@ -468,11 +488,15 @@ jobs:
shell: bash
run: echo "::set-output name=commit::$(git rev-parse HEAD)"
- name: Setup Vcpkg
+ id: setup-vcpkg
uses: friendlyanon/setup-vcpkg@v1
with:
path: wrappers/realm-core/tools/vcpkg/ports
- cache-key: vcpkg-windows-${{ matrix.arch }}-${{ hashFiles('./wrappers/realm-core/tools/vcpkg/vcpkg.json') }}-${{ steps.vcpkg_cache_key.outputs.commit }}
- cache-restore-keys: vcpkg-windows-${{ matrix.arch }}-
+ cache-key: vcpkg3-windows-${{ matrix.arch }}-${{ steps.vcpkg_cache_key.outputs.commit }}-${{ hashFiles('./wrappers/realm-core/tools/vcpkg/vcpkg.json') }}
+ cache-restore-keys: vcpkg3-windows-${{ matrix.arch }}-${{ steps.vcpkg_cache_key.outputs.commit }}
+ - name: Refetch vcpkg
+ run: git fetch --unshallow
+ working-directory: wrappers/realm-core/tools/vcpkg/ports
- name: Build wrappers
run: pwsh ./wrappers/build.ps1 Windows -Platforms ${{ matrix.arch }} -Configuration Release -EnableLTO
if: steps.check-cache.outputs.cache-hit != 'true'
@@ -482,6 +506,7 @@ jobs:
name: wrappers-windows-${{ matrix.arch }}
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
+ if-no-files-found: error
if: needs.check-cache.outputs.wrappers-windows-Win32 != 'true' || needs.check-cache.outputs.wrappers-windows-x64 != 'true' || needs.check-cache.outputs.wrappers-windows-ARM64 != 'true'
uwp:
runs-on: windows-latest
@@ -514,11 +539,15 @@ jobs:
shell: bash
run: echo "::set-output name=commit::$(git rev-parse HEAD)"
- name: Setup Vcpkg
+ id: setup-vcpkg
uses: friendlyanon/setup-vcpkg@v1
with:
path: wrappers/realm-core/tools/vcpkg/ports
- cache-key: vcpkg-uwp-${{ matrix.arch }}-${{ hashFiles('./wrappers/realm-core/tools/vcpkg/vcpkg.json') }}-${{ steps.vcpkg_cache_key.outputs.commit }}
- cache-restore-keys: vcpkg-uwp-${{ matrix.arch }}-
+ cache-key: vcpkg3-uwp-${{ matrix.arch }}-${{ steps.vcpkg_cache_key.outputs.commit }}-${{ hashFiles('./wrappers/realm-core/tools/vcpkg/vcpkg.json') }}
+ cache-restore-keys: vcpkg3-uwp-${{ matrix.arch }}-${{ steps.vcpkg_cache_key.outputs.commit }}
+ - name: Refetch vcpkg
+ run: git fetch --unshallow
+ working-directory: wrappers/realm-core/tools/vcpkg/ports
- name: Build wrappers
run: pwsh ./wrappers/build.ps1 WindowsStore -Platforms ${{ matrix.arch }} -Configuration Release -EnableLTO
if: steps.check-cache.outputs.cache-hit != 'true'
@@ -528,4 +557,5 @@ jobs:
name: wrappers-windows-uwp-${{ matrix.arch }}
path: ${{ github.workspace }}/wrappers/build/**
retention-days: 1
+ if-no-files-found: error
if: needs.check-cache.outputs.wrappers-windows-uwp-Win32 != 'true' || needs.check-cache.outputs.wrappers-windows-uwp-x64 != 'true' || needs.check-cache.outputs.wrappers-windows-uwp-ARM != 'true' || needs.check-cache.outputs.wrappers-windows-uwp-ARM64 != 'true'
diff --git a/Realm/Realm/DatabaseTypes/Accessors/ManagedAccessor.cs b/Realm/Realm/DatabaseTypes/Accessors/ManagedAccessor.cs
index c43ea5f171..256568304a 100644
--- a/Realm/Realm/DatabaseTypes/Accessors/ManagedAccessor.cs
+++ b/Realm/Realm/DatabaseTypes/Accessors/ManagedAccessor.cs
@@ -155,15 +155,9 @@ public void UnsubscribeFromNotifications()
}
///
- void INotifiable.NotifyCallbacks(NotifiableObjectHandleBase.CollectionChangeSet? changes, NativeException? exception)
+ void INotifiable.NotifyCallbacks(NotifiableObjectHandleBase.CollectionChangeSet? changes)
{
- var managedException = exception?.Convert();
-
- if (managedException != null)
- {
- Realm.NotifyError(managedException);
- }
- else if (changes.HasValue)
+ if (changes.HasValue)
{
foreach (int propertyIndex in changes.Value.Properties.AsEnumerable())
{
diff --git a/Realm/Realm/DatabaseTypes/INotifiable.cs b/Realm/Realm/DatabaseTypes/INotifiable.cs
index 4bb7be0a64..18f02ba45e 100644
--- a/Realm/Realm/DatabaseTypes/INotifiable.cs
+++ b/Realm/Realm/DatabaseTypes/INotifiable.cs
@@ -33,8 +33,7 @@ internal interface INotifiable
/// Method called when there are changes to report for that object.
///
/// The changes that occurred.
- /// An exception if one occurred.
- void NotifyCallbacks(TChangeset? changes, NativeException? exception);
+ void NotifyCallbacks(TChangeset? changes);
}
internal class NotificationToken : IDisposable
diff --git a/Realm/Realm/DatabaseTypes/RealmCollectionBase.cs b/Realm/Realm/DatabaseTypes/RealmCollectionBase.cs
index 5b2008257a..82df3fa922 100644
--- a/Realm/Realm/DatabaseTypes/RealmCollectionBase.cs
+++ b/Realm/Realm/DatabaseTypes/RealmCollectionBase.cs
@@ -41,7 +41,7 @@ public abstract class RealmCollectionBase
IThreadConfined,
IMetadataObject
{
- private readonly List> _callbacks = new List>();
+ private readonly List> _callbacks = new();
private NotificationTokenHandle _notificationToken;
@@ -395,9 +395,8 @@ private void UpdateCollectionChangedSubscriptionIfNecessary(bool isSubscribed)
#endregion INotifyCollectionChanged
- void INotifiable.NotifyCallbacks(NotifiableObjectHandleBase.CollectionChangeSet? changes, NativeException? exception)
+ void INotifiable.NotifyCallbacks(NotifiableObjectHandleBase.CollectionChangeSet? changes)
{
- var managedException = exception?.Convert();
ChangeSet changeset = null;
if (changes != null)
{
@@ -417,7 +416,7 @@ private void UpdateCollectionChangedSubscriptionIfNecessary(bool isSubscribed)
foreach (var callback in _callbacks.ToArray())
{
- callback(this, changeset, managedException);
+ callback(this, changeset, null);
}
}
diff --git a/Realm/Realm/DatabaseTypes/RealmDictionary.cs b/Realm/Realm/DatabaseTypes/RealmDictionary.cs
index b9776d7e01..2fd8a78baf 100644
--- a/Realm/Realm/DatabaseTypes/RealmDictionary.cs
+++ b/Realm/Realm/DatabaseTypes/RealmDictionary.cs
@@ -236,9 +236,8 @@ private static string ValidateKey(string key)
protected override KeyValuePair GetValueAtIndex(int index) => _dictionaryHandle.GetValueAtIndex(index, Realm);
- void INotifiable.NotifyCallbacks(DictionaryHandle.DictionaryChangeSet? changes, NativeException? exception)
+ void INotifiable.NotifyCallbacks(DictionaryHandle.DictionaryChangeSet? changes)
{
- var managedException = exception?.Convert();
DictionaryChangeSet changeset = null;
if (changes != null)
{
@@ -255,7 +254,7 @@ private static string ValidateKey(string key)
foreach (var callback in _keyCallbacks.ToArray())
{
- callback(this, changeset, managedException);
+ callback(this, changeset, null);
}
}
}
diff --git a/Realm/Realm/Exceptions/Sync/ClientError.cs b/Realm/Realm/Exceptions/Sync/ClientError.cs
index 9a343e1c9b..4697cc5710 100644
--- a/Realm/Realm/Exceptions/Sync/ClientError.cs
+++ b/Realm/Realm/Exceptions/Sync/ClientError.cs
@@ -31,4 +31,11 @@ internal enum SessionErrorCategory : byte
ClientError = 0,
SessionError = 1
}
+
+ internal enum ServerRequestsAction
+ {
+ NoAction = 0,
+ ApplicationBug = 2,
+ ClientReset = 6
+ }
}
diff --git a/Realm/Realm/Extensions/TestingExtensions.cs b/Realm/Realm/Extensions/TestingExtensions.cs
index 275da6939f..de652fb984 100644
--- a/Realm/Realm/Extensions/TestingExtensions.cs
+++ b/Realm/Realm/Extensions/TestingExtensions.cs
@@ -44,7 +44,7 @@ public static void SimulateError(this Session session, ErrorCode errorCode, stri
Argument.NotNull(session, nameof(session));
Argument.NotNull(message, nameof(message));
- session.ReportErrorForTesting((int)errorCode, SessionErrorCategory.SessionError, message, isFatal);
+ session.ReportErrorForTesting((int)errorCode, SessionErrorCategory.SessionError, message, isFatal, ServerRequestsAction.ApplicationBug);
}
///
@@ -60,7 +60,7 @@ public static void SimulateClientReset(this Session session, string message)
Argument.NotNull(session, nameof(session));
Argument.NotNull(message, nameof(message));
- session.ReportErrorForTesting((int)ErrorCode.DivergingHistories, SessionErrorCategory.SessionError, message, false);
+ session.ReportErrorForTesting((int)ErrorCode.DivergingHistories, SessionErrorCategory.SessionError, message, false, ServerRequestsAction.ClientReset);
}
///
@@ -73,7 +73,7 @@ public static void SimulateAutomaticClientResetFailure(this Session session, str
Argument.NotNull(session, nameof(session));
Argument.NotNull(message, nameof(message));
- session.ReportErrorForTesting((int)ClientError.AutoClientResetFailed, SessionErrorCategory.ClientError, message, false);
+ session.ReportErrorForTesting((int)ClientError.AutoClientResetFailed, SessionErrorCategory.ClientError, message, false, ServerRequestsAction.NoAction);
}
}
}
diff --git a/Realm/Realm/Handles/DictionaryHandle.cs b/Realm/Realm/Handles/DictionaryHandle.cs
index 20789eb3fe..38e6ea393a 100644
--- a/Realm/Realm/Handles/DictionaryHandle.cs
+++ b/Realm/Realm/Handles/DictionaryHandle.cs
@@ -34,7 +34,7 @@ internal struct DictionaryChangeSet
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- public delegate void KeyNotificationCallback(IntPtr managedHandle, IntPtr changes, IntPtr notificationException);
+ public delegate void KeyNotificationCallback(IntPtr managedHandle, IntPtr changes);
private static class NativeMethods
{
@@ -334,11 +334,11 @@ public ResultsHandle GetKeys()
}
[MonoPInvokeCallback(typeof(KeyNotificationCallback))]
- public static void NotifyDictionaryChanged(IntPtr managedHandle, IntPtr changes, IntPtr exception)
+ public static void NotifyDictionaryChanged(IntPtr managedHandle, IntPtr changes)
{
if (GCHandle.FromIntPtr(managedHandle).Target is INotifiable notifiable)
{
- notifiable.NotifyCallbacks(new PtrTo(changes).Value, new PtrTo(exception).Value);
+ notifiable.NotifyCallbacks(new PtrTo(changes).Value);
}
}
}
diff --git a/Realm/Realm/Handles/NotifiableObjectHandleBase.cs b/Realm/Realm/Handles/NotifiableObjectHandleBase.cs
index 14f14d280a..af22218663 100644
--- a/Realm/Realm/Handles/NotifiableObjectHandleBase.cs
+++ b/Realm/Realm/Handles/NotifiableObjectHandleBase.cs
@@ -45,7 +45,7 @@ public struct Move
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
- public delegate void NotificationCallback(IntPtr managedHandle, IntPtr changes, IntPtr notificationException);
+ public delegate void NotificationCallback(IntPtr managedHandle, IntPtr changes);
protected NotifiableObjectHandleBase(SharedRealmHandle root, IntPtr handle) : base(root, handle)
{
@@ -56,11 +56,11 @@ protected NotifiableObjectHandleBase(SharedRealmHandle root, IntPtr handle) : ba
public abstract ThreadSafeReferenceHandle GetThreadSafeReference();
[MonoPInvokeCallback(typeof(NotificationCallback))]
- public static void NotifyObjectChanged(IntPtr managedHandle, IntPtr changes, IntPtr exception)
+ public static void NotifyObjectChanged(IntPtr managedHandle, IntPtr changes)
{
if (GCHandle.FromIntPtr(managedHandle).Target is INotifiable notifiable)
{
- notifiable.NotifyCallbacks(new PtrTo(changes).Value, new PtrTo(exception).Value);
+ notifiable.NotifyCallbacks(new PtrTo(changes).Value);
}
}
}
diff --git a/Realm/Realm/Handles/SessionHandle.cs b/Realm/Realm/Handles/SessionHandle.cs
index 7a1c04aed4..6ee3ec6181 100644
--- a/Realm/Realm/Handles/SessionHandle.cs
+++ b/Realm/Realm/Handles/SessionHandle.cs
@@ -104,7 +104,7 @@ public static extern ulong register_progress_notifier(SessionHandle session,
public static extern void wait(SessionHandle session, IntPtr task_completion_source, ProgressDirection direction, out NativeException ex);
[DllImport(InteropConfig.DLL_NAME, EntryPoint = "realm_syncsession_report_error_for_testing", CallingConvention = CallingConvention.Cdecl)]
- public static extern void report_error_for_testing(SessionHandle session, int error_code, SessionErrorCategory error_category, [MarshalAs(UnmanagedType.LPWStr)] string message, IntPtr message_len, [MarshalAs(UnmanagedType.U1)] bool is_fatal);
+ public static extern void report_error_for_testing(SessionHandle session, int error_code, SessionErrorCategory error_category, [MarshalAs(UnmanagedType.LPWStr)] string message, IntPtr message_len, [MarshalAs(UnmanagedType.U1)] bool is_fatal, int action);
[DllImport(InteropConfig.DLL_NAME, EntryPoint = "realm_syncsession_stop", CallingConvention = CallingConvention.Cdecl)]
public static extern void stop(SessionHandle session, out NativeException ex);
@@ -237,9 +237,9 @@ public IntPtr GetRawPointer()
return NativeMethods.get_raw_pointer(this);
}
- public void ReportErrorForTesting(int errorCode, SessionErrorCategory errorCategory, string errorMessage, bool isFatal)
+ public void ReportErrorForTesting(int errorCode, SessionErrorCategory errorCategory, string errorMessage, bool isFatal, ServerRequestsAction action)
{
- NativeMethods.report_error_for_testing(this, errorCode, errorCategory, errorMessage, (IntPtr)errorMessage.Length, isFatal);
+ NativeMethods.report_error_for_testing(this, errorCode, errorCategory, errorMessage, (IntPtr)errorMessage.Length, isFatal, (int)action);
}
public void Stop()
diff --git a/Realm/Realm/Sync/Session.cs b/Realm/Realm/Sync/Session.cs
index 93d74a1fb6..cf5f56fcad 100644
--- a/Realm/Realm/Sync/Session.cs
+++ b/Realm/Realm/Sync/Session.cs
@@ -217,7 +217,7 @@ internal void CloseHandle(bool waitForShutdown = false)
}
}
- internal void ReportErrorForTesting(int errorCode, SessionErrorCategory sessionErrorCategory, string errorMessage, bool isFatal) => Handle.ReportErrorForTesting(errorCode, sessionErrorCategory, errorMessage, isFatal);
+ internal void ReportErrorForTesting(int errorCode, SessionErrorCategory sessionErrorCategory, string errorMessage, bool isFatal, ServerRequestsAction action) => Handle.ReportErrorForTesting(errorCode, sessionErrorCategory, errorMessage, isFatal, action);
internal static void RaiseError(Session session, Exception error)
{
diff --git a/Tests/Realm.Tests/Sync/DataTypeSynchronizationTests.cs b/Tests/Realm.Tests/Sync/DataTypeSynchronizationTests.cs
index 241ffe5888..3263405926 100644
--- a/Tests/Realm.Tests/Sync/DataTypeSynchronizationTests.cs
+++ b/Tests/Realm.Tests/Sync/DataTypeSynchronizationTests.cs
@@ -223,7 +223,7 @@ public class DataTypeSynchronizationTests : SyncTestBase
#endregion
- #region Byte
+ #region Binary
[Test]
public void List_Binary() => TestListCore(o => o.ByteArrayList, TestHelpers.GetBytes(5), TestHelpers.GetBytes(6), (a, b) => a.SequenceEqual(b));
@@ -317,18 +317,14 @@ private void TestListCore(Func> getter, T ite
list1.Add(item1);
});
- await WaitForCollectionChangeAsync(list2.AsRealmCollection());
-
- Assert.That(list1, Is.EquivalentTo(list2).Using(equalsOverride), "Add from list1 should arrive at list2");
+ await WaitForCollectionAsync(list2, list1, equalsOverride, "add from 1 shows up in 2");
realm2.Write(() =>
{
list2.Add(item2);
});
- await WaitForCollectionChangeAsync(list1.AsRealmCollection());
-
- Assert.That(list1, Is.EquivalentTo(list2).Using(equalsOverride), "Add from list2 should arrive at list1");
+ await WaitForCollectionAsync(list1, list2, equalsOverride, "add from 2 shows up in 1");
// Assert Remove works
realm2.Write(() =>
@@ -336,9 +332,7 @@ private void TestListCore(Func> getter, T ite
list2.Remove(list2.First());
});
- await WaitForCollectionChangeAsync(list1.AsRealmCollection());
-
- Assert.That(list1, Is.EquivalentTo(list2).Using(equalsOverride), "Remove from list2 should arrive at list1");
+ await WaitForCollectionAsync(list1, list2, equalsOverride, "remove from 2 shows up in 1");
// Assert Clear works
realm1.Write(() =>
@@ -346,7 +340,7 @@ private void TestListCore(Func> getter, T ite
list1.Clear();
});
- await TestHelpers.WaitForConditionAsync(() => !list2.Any());
+ await TestHelpers.WaitForConditionAsync(() => !list2.Any(), errorMessage: "clear from 1 shows up in 2");
Assert.That(list1, Is.Empty);
Assert.That(list2, Is.Empty);
@@ -382,18 +376,14 @@ private void TestSetCore(Func> getter, T item1
set1.Add(item1);
});
- await WaitForCollectionChangeAsync(set2.AsRealmCollection());
-
- Assert.That(set1, Is.EquivalentTo(set2).Using(equalsOverride));
+ await WaitForCollectionAsync(set2, set1, equalsOverride, "add from 1 shows up in 2");
realm2.Write(() =>
{
set2.Add(item2);
});
- await WaitForCollectionChangeAsync(set1.AsRealmCollection());
-
- Assert.That(set1, Is.EquivalentTo(set2).Using(equalsOverride));
+ await WaitForCollectionAsync(set1, set2, equalsOverride, "add from 2 shows up in 1");
// Assert Remove works
realm2.Write(() =>
@@ -401,9 +391,7 @@ private void TestSetCore(Func> getter, T item1
set2.Remove(set2.First());
});
- await WaitForCollectionChangeAsync(set1.AsRealmCollection());
-
- Assert.That(set1, Is.EquivalentTo(set2).Using(equalsOverride));
+ await WaitForCollectionAsync(set1, set2, equalsOverride, "remove from 2 shows up in 1");
// Assert Clear works
realm1.Write(() =>
@@ -411,7 +399,7 @@ private void TestSetCore(Func> getter, T item1
set1.Clear();
});
- await TestHelpers.WaitForConditionAsync(() => !set2.Any());
+ await TestHelpers.WaitForConditionAsync(() => !set2.Any(), errorMessage: "clear from 1 shows up in 2");
Assert.That(set1, Is.Empty);
Assert.That(set2, Is.Empty);
@@ -450,18 +438,14 @@ private void TestDictionaryCore(Func
{
dict2[key2] = item2;
});
- await WaitForCollectionChangeAsync(dict1.AsRealmCollection());
-
- Assert.That(dict1, Is.EquivalentTo(dict2).Using(comparer));
+ await WaitForCollectionAsync(dict1, dict2, comparer, "add from 2 shows up in 1");
// Assert Update works
// item2 might belong to realm2, so let's find the equivalent in realm1
@@ -472,9 +456,7 @@ private void TestDictionaryCore(Func
@@ -482,9 +464,7 @@ private void TestDictionaryCore(Func
@@ -492,7 +472,7 @@ private void TestDictionaryCore(Func !dict2.Any(), errorMessage: "clear from 1 shows up in 2");
Assert.That(dict1, Is.Empty);
Assert.That(dict2, Is.Empty);
@@ -643,23 +623,40 @@ void RealmObject_PropertyChanged(object sender, System.ComponentModel.PropertyCh
realmObject.PropertyChanged -= RealmObject_PropertyChanged;
}
- private static async Task WaitForCollectionChangeAsync(IRealmCollection collection, int timeout = 10 * 1000)
+ private static async Task WaitForCollectionAsync(IEnumerable first, IEnumerable second, Func comparer, string message)
{
- var tcs = new TaskCompletionSource