Farfetch / kafkaflow

Apache Kafka .NET Framework to create applications simple to use and extend.
https://farfetch.github.io/kafkaflow/
MIT License
653 stars 118 forks source link

[Bug Report]: Incompatibility with Microsoft.IO.RecyclableMemoryStream 3.0.0 #504

Closed morinow closed 9 months ago

morinow commented 10 months ago

Prerequisites

Description

It seems like the current KafkaFlow package (3.0.3) is not compatible with the most recent version 3.0.0 of Microsoft.IO.RecyclableMemoryStream. When using 3.0.0 of Microsoft.IO.RecyclableMemoryStream and KafkaFlow together, you encounter an MethodNotFoundException:

Method not found: 'System.IO.MemoryStream Microsoft.IO.RecyclableMemoryStreamManager.GetStream()'

This is most likely due to breaking changes introduced in Microsoft.IO.RecyclableMemoryStream 3.0.0.

I am opening this issue as a bug as this incompatibility comes rather unexpected, even though I am fully aware, that this is of course not at the fault of KafkaFlow.

Maybe there is a way to adjust the current usage of Microsoft.IO.RecyclableMemoryStream to the breaking changes?

Here is a more detailed StackTrace:

---> System.MissingMethodException: Method not found: 'System.IO.MemoryStream Microsoft.IO.RecyclableMemoryStreamManager.GetStream()'.
         at KafkaFlow.Middlewares.Serializer.SerializerProducerMiddleware.Invoke(IMessageContext context, MiddlewareDelegate next)
         at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
         at KafkaFlow.Middlewares.Serializer.SerializerProducerMiddleware.Invoke(IMessageContext context, MiddlewareDelegate next)
         at KafkaFlow.MiddlewareExecutor.ExecuteDefinition(Int32 index, IMessageContext context, Func`2 nextOperation)
         at KafkaFlow.MiddlewareExecutor.Execute(IMessageContext context, Func`2 nextOperation)
         at KafkaFlow.Producers.MessageProducer.ProduceAsync(String topic, Object messageKey, Object messageValue, IMessageHeaders headers, Nullable`1 partition)
         at KafkaFlow.Producers.MessageProducer.ProduceAsync(String topic, Object messageKey, Object messageValue, IMessageHeaders headers, Nullable`1 partition)

Steps to reproduce

  1. Install KafkaFlow package
  2. Install Microsoft.IO.RecyclableMemoryStream 3.0.0
  3. Run anything KafkaFlow related (e.g. produce messages)

Expected behavior

No exception

Actual behavior

Exception

KafkaFlow version

3.0.3

sinanerkan commented 10 months ago

Any plans to address this? I have another package which depends on Microsoft.IO.RecyclableMemoryStream as well. They've updated their dependency from 2.3.2 to 3.0.0

Now it's impossible to use a package which uses version 3.0.0 as a dependency alongside with KafkaFlow.