YehudaKremer / msix

Create Msix installer for flutter windows-build files.
https://pub.dev/packages/msix
MIT License
273 stars 64 forks source link

[BUG] Unexpected extension byte (at offset 99) #231

Open dotupNET opened 10 months ago

dotupNET commented 10 months ago

:information_source: Info

Version: v3.16.1

:speech_balloon: Description

With dart run msix:build -v I get the following error:

**Enter a description of your problem here.

PS C:\src\xxx> dart run msix:build -v [ 0.022s] parsing cli arguments [ 0.128s] validating config values [ 0.146s] pack files in build folder: C:\src\xxx\build\windows\runner\Release [ 0.148s] building msix files... [ 0.149s] validating build files [ 0.160s] cleaning temporary files [ 0.198s] create app icons [ 0.200s] generating icons [ 6.539s] copying VC libraries [ 6.565s] getting certificate publisher [ 6.566s] getting certificate "Subject" by file certificate Unhandled exception: FormatException: Unexpected extension byte (at offset 99)

0 _Utf8Decoder.convertChunked (dart:convert-patch/convert_patch.dart:1851:7)

1 _Utf8ConversionSink.addSlice (dart:convert/string_conversion.dart:304:28)

2 _Utf8ConversionSink.add (dart:convert/string_conversion.dart:300:5)

3 _ConverterStreamEventSink.add (dart:convert/chunked_conversion.dart:69:18)

4 _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:111:24)

5 _RootZone.runUnaryGuarded (dart:async/zone.dart:1594:10)

6 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)

7 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)

8 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:784:19)

9 _StreamController._add (dart:async/stream_controller.dart:658:7)

10 _StreamController.add (dart:async/stream_controller.dart:606:5)

11 _Socket._onData (dart:io-patch/socket_patch.dart:2445:41)

12 _RootZone.runUnaryGuarded (dart:async/zone.dart:1594:10)

13 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)

14 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)

15 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:784:19)

16 _StreamController._add (dart:async/stream_controller.dart:658:7)

17 _StreamController.add (dart:async/stream_controller.dart:606:5)

18 new _RawSocket. (dart:io-patch/socket_patch.dart:1934:33)

19 _NativeSocket.issueReadEvent.issue (dart:io-patch/socket_patch.dart:1377:14)

20 _microtaskLoop (dart:async/schedule_microtask.dart:40:21)

21 _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)

22 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:123:13)

23 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:190:5)

:scroll: Pubspec.yaml


name: xxx
description: xxx App.
publish_to: 'none'

version: 1.0.0+42

environment:
  sdk: ">=2.18.0 <3.0.0"
  flutter: ">=3.3.0"

dependencies:
  flutter:
    sdk: flutter

  flutter_bloc: ^8.1.2
  provider: ^6.0.5
  font_awesome_flutter: ^10.4.0
  mobile_scanner: ^3.2.0
  collection: ^1.17.1
  geocoding: ^2.1.0

dev_dependencies:
  flutter_test:
    sdk: flutter

  flutter_lints: ^2.0.1
  bloc_test: ^9.1.1
  flutter_launcher_icons: ^0.13.1
  msix: ^3.16.1

msix_config:
  display_name: xxx
  publisher_display_name: xxx
  identity_name: apps.xxx.com
  msix_version: 1.0.2.0
  start_menu_icon_path: C:\src\xxx\assets\launcher\xxx-dev.png
  tile_icon_path: C:\src\xxx\assets\launcher\xxx-dev.png
  logo_path: C:\src\xxx\assets\launcher\xxx-dev.png
  store: false
  build_windows: false
  capabilities: internetClient, location

flutter: 
  uses-material-design: true

  assets:
    # Add assets from the images directory to the application.
    - assets/json_data/
Mino5531 commented 10 months ago

Hi, I'm getting the same error when trying to run the command. I believe it may be caused by special characters in the SubjectDN? The command does work for me on version: v3.5.0

mjauernig commented 9 months ago

Hi, I could create msix files. Then from one moment to the other the `FormatException: Unexpected extension byte (at offset x)'. After removing and reattaching the hardware token (with the certificate) the problem disappeared.

JHenneberg commented 7 months ago

I am building without certificate --install-certificate false and it is working on local machine but not on CI. Can not figure out why.

both are running flutter 3.16.3

mjauernig commented 6 months ago

Hi,

today i had the same problem again. With the following workaround it works.

  1. Launch powershell
  2. Run dir -Recurse cert: |where {$_.Thumbprint -eq "ebd5c80a896aa6c9f2ceXb86ff90e33853520b5b"}. Replace ebd5c80a896aa6c9f2ceXb86ff90e33853520b5b with the thumbrint of your cert.
  3. Copy the output and set it as value of parameter publisher in pubspec.yaml und msix_config. Example publisher: CN=xxx, O=aaa, STREET=Am BacH 4-8, L=Berlin, S=Hessen, C=DE, OID.1.3.6.1.4.1.311.60.2.1.1=Berlin, OID.1.3.6.1.4.1.311.60.2.1.2=Hessen, OID.1.3.6.1.4.1.311.60.2.1.3=DE, SERIALNUMBER=HRB 12345, OID.2.5.4.15=Private Organization

P.S. The workaround use the behaivior, that the package either try to read the publisher from cert or use the given value from config. See sign_tool.dart