У меня возникла проблема с net7.0, изолированным от dotnet: в документации сказано, что я могу работать с потоком, но у меня происходит сбой кода.
Я работаю со следующими пакетами:
Executing 'Functions.CMImageResizer' (Reason='New blob detected(LogsAndContainerScan): rawimages/taladro1.jpg', Id=00c22256-e65c-478c-82c3-eaca92c310b7)
[2023-12-24T05:35:39.632Z] Trigger Details: MessageId: 2f450295-dae1-42f5-ac2e-089d5b0d2a55, DequeueCount: 1, InsertedOn: 2023-12-24T05:35:38.000+00:00, BlobCreated: 2023-12-24T04:42:41.000+00:00, BlobLastModified: 2023-12-24T05:35:28.000+00:00 [2023-12-24T05:35:40.601Z] Function 'CMImageResizer',
Invocation id '00c22256-e65c-478c-82c3-eaca92c310b7': An exception was thrown by the invocation. [2023-12-24T05:35:40.604Z] Result: Function 'CMImageResizer', Invocation id '00c22256-e65c-478c-82c3-eaca92c310b7': An exception was thrown by the invocation. [2023-12-24T05:35:40.604Z] Exception: Microsoft.Azure.Functions.Worker.FunctionInputConverterException:
Error converting 1 input parameters for Function 'CMImageResizer': Cannot convert input parameter 'myBlob' to type 'System.IO.Stream' from type 'System.ReadOnlyMemory1[[System.Byte, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]'. Error:System.Text.Json.JsonException: 'R' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0.
[2023-12-24T05:35:40.604Z] ---> System.Text.Json.JsonReaderException: 'R' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0.
[2023-12-24T05:35:40.604Z] at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan1 bytes) [2023-12-24T05:35:40.604Z] at System.Text.Json.Utf8JsonReader.ConsumeValue(Byte marker) [2023-12-24T05:35:40.604Z] at System.Text.Json.Utf8JsonReader.ReadFirstToken(Byte first) [2023-12-24T05:35:40.604Z] at System.Text.Json.Utf8JsonReader.ReadSingleSegment() [2023-12-24T05:35:40.604Z] at System.Text.Json.Utf8JsonReader.Read() [2023-12-24T05:35:40.604Z] at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
Что не так, ведь в документации сказано, что теперь воркер позволяет работать с потоком.
У меня возникла проблема с net7.0, изолированным от dotnet: в документации сказано, что я могу работать с потоком, но у меня происходит сбой кода. Я работаю со следующими пакетами: [code]
[/code] Моя функция такова: [code][Function(nameof(CMImageResizer))] public async Task Run( [BlobTrigger("rawimages/{name}", Connection = "StorageAccountConnectionString")] Stream myBlob, [BlobInput("resizedimages/{name}", Connection = "StorageAccountConnectionString")] Stream resizedImage, string name) { try { _log.LogInformation("Processing image:{name} size: {myBlobLength} Bytes", name, myBlob.Length); [/code] И код ошибки: [code]Executing 'Functions.CMImageResizer' (Reason='New blob detected(LogsAndContainerScan): rawimages/taladro1.jpg', Id=00c22256-e65c-478c-82c3-eaca92c310b7) [2023-12-24T05:35:39.632Z] Trigger Details: MessageId: 2f450295-dae1-42f5-ac2e-089d5b0d2a55, DequeueCount: 1, InsertedOn: 2023-12-24T05:35:38.000+00:00, BlobCreated: 2023-12-24T04:42:41.000+00:00, BlobLastModified: 2023-12-24T05:35:28.000+00:00 [2023-12-24T05:35:40.601Z] Function 'CMImageResizer', Invocation id '00c22256-e65c-478c-82c3-eaca92c310b7': An exception was thrown by the invocation. [2023-12-24T05:35:40.604Z] Result: Function 'CMImageResizer', Invocation id '00c22256-e65c-478c-82c3-eaca92c310b7': An exception was thrown by the invocation. [2023-12-24T05:35:40.604Z] Exception: Microsoft.Azure.Functions.Worker.FunctionInputConverterException: Error converting 1 input parameters for Function 'CMImageResizer': Cannot convert input parameter 'myBlob' to type 'System.IO.Stream' from type 'System.ReadOnlyMemory1[[System.Byte, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]'. Error:System.Text.Json.JsonException: 'R' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0. [2023-12-24T05:35:40.604Z] ---> System.Text.Json.JsonReaderException: 'R' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0. [2023-12-24T05:35:40.604Z] at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan1 bytes) [2023-12-24T05:35:40.604Z] at System.Text.Json.Utf8JsonReader.ConsumeValue(Byte marker) [2023-12-24T05:35:40.604Z] at System.Text.Json.Utf8JsonReader.ReadFirstToken(Byte first) [2023-12-24T05:35:40.604Z] at System.Text.Json.Utf8JsonReader.ReadSingleSegment() [2023-12-24T05:35:40.604Z] at System.Text.Json.Utf8JsonReader.Read() [2023-12-24T05:35:40.604Z] at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) [/code] Что не так, ведь в документации сказано, что теперь воркер позволяет работать с потоком.