Event binding bug found

This commit is contained in:
2025-05-07 09:03:20 +03:00
parent 99015a3d5e
commit 2f65fb24c0
5 changed files with 13 additions and 12 deletions
+4 -5
View File
@@ -16,11 +16,11 @@ using mROA.Implementation.Frontend;
class Program
{
public static void Main(string[] args)
public static async Task Main(string[] args)
{
var builder = new FullMixBuilder();
new RemoteTypeBinder();
// builder.Modules.Add(new JsonSerializationToolkit());
builder.Modules.Add(new CborSerializationToolkit());
builder.Modules.Add(new EndPointContext());
builder.Modules.Add(new RemoteContextRepository());
@@ -39,7 +39,7 @@ class Program
builder.Build();
var frontendBridge = builder.GetModule<IFrontendBridge>()!;
frontendBridge.Connect();
await frontendBridge.Connect();
_ = builder.GetModule<RequestExtractor>()!.StartExtraction();
_ = builder.GetModule<UdpUntrustedInteraction>().Start(serverEndPoint);
Console.WriteLine(builder.GetModule<IEndPointContext>().HostId);
@@ -87,8 +87,7 @@ class Program
Console.WriteLine("Names: " + string.Join(", ", names));
var page = disposingPrinter.Print("Test Page", false, default, CancellationToken.None).GetAwaiter()
.GetResult();
var page = await disposingPrinter.Print("Test Page", false, default, CancellationToken.None);
Console.WriteLine("Page printed");
DemoCheck.TaskExecution = true;
Console.WriteLine(page.ToString());
+2 -1
View File
@@ -213,7 +213,8 @@ namespace mROA.Cbor
if (obj is IShared)
{
var generic = obj.GetType().GetInterfaces().FirstOrDefault(i => typeof(IShared).IsAssignableFrom(i));
var interfaces = obj.GetType().GetInterfaces();
var generic = interfaces.FirstOrDefault(i => typeof(IShared).IsAssignableFrom(i));
var sharedShell = typeof(SharedObjectShellShell<>).MakeGenericType(generic);
var so =
Activator.CreateInstance(sharedShell, obj, context) as
+2 -1
View File
@@ -1,10 +1,11 @@
using System;
using System.Threading.Tasks;
namespace mROA.Abstract
{
public interface IFrontendBridge : IInjectableModule, IDisposable
{
void Connect();
Task Connect();
void Obstacle();
void Disconnect();
}
@@ -33,8 +33,8 @@ namespace mROA.Implementation.Backend
{
var last = _storage.Place(o);
EventBinders.OfType<IEventBinder<T>>().FirstOrDefault()
?.BindEvents((T)o, context, _representationModuleProducer!, last);
var binder = EventBinders.OfType<IEventBinder<T>>().FirstOrDefault();
binder?.BindEvents((T)o, context, _representationModuleProducer!, last);
return last;
}
@@ -40,7 +40,7 @@ namespace mROA.Implementation.Frontend
}
}
public void Connect()
public async Task Connect()
{
if (_interactionModule is null)
throw new Exception("Interaction module was not injected");
@@ -57,7 +57,7 @@ namespace mROA.Implementation.Frontend
.Wait();
_currentExtractor.SingleReceive();
var idMessage = _interactionModule.GetNextMessageReceiving(false).GetAwaiter().GetResult();
var idMessage = await _interactionModule.GetNextMessageReceiving(false);
if (idMessage.MessageType != EMessageType.IdAssigning)
{