reactiveui / ReactiveUI

An advanced, composable, functional reactive model-view-viewmodel framework for all .NET platforms that is inspired by functional reactive programming. ReactiveUI allows you to abstract mutable state away from your user interfaces, express the idea around a feature in one readable place and improve the testability of your application.
https://www.reactiveui.net
MIT License
8.12k stars 1.12k forks source link

[Bug]: “ReactiveUI.ViewForMixins”的类型初始值设定项引发异常 #3934

Open yangl1025 opened 5 days ago

yangl1025 commented 5 days ago

Describe the bug 🐞

System.TypeInitializationException: “ReactiveUI.ViewForMixins”的类型初始值设定项引发异常。 ---> System.BadImageFormatException: 未能加载文件或程序集“System.ValueTuple, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51”或它的某一个依赖项。不应出于执行的目的加载引用程序集。只能在仅限反射的加载程序上下文中加载引用程序集。 (异常来自 HRESULT:0x80131058) ---> System.BadImageFormatException: 无法加载引用程序集来执行。

Step to reproduce

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Reproduction repository

https://github.com/reactiveui/ReactiveUI

Expected behavior

when i run the vs ,it's ok。but I use the setup program ,when I install the msi ,the program throw exception。

Screenshots 🖼️

No response

IDE

Visual Studio 2022

Operating system

windows

Version

11

Device

windows

ReactiveUI Version

19.6.1

Additional information ℹ️

No response

dpvreony commented 5 days ago

System.BadImageFormatException is where you are deploying a x86 app trying to access x64 binaries (or x64 trying to load x86) . i'd look at your release build profile and what is being put into your installer. try and keep assemblies to AnyCPU where you can. exe target would typically be what would change, but even this isn't usually necessary unless you're accessing the registry etc.

have a read through https://stackoverflow.com/questions/8996653/troubleshooting-badimageformatexception for ideas on troubleshooting

yangl1025 commented 4 days ago

image image