Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Error al migrar a MysqlConnector #1447

Unanswered
sistemasIHS asked this question in Q&A
Feb 9, 2024 · 1 comments · 4 replies
Discussion options

Hola, buenas, hice una actualizacion de MySql.Data.MySqlClien; a Mysqlconnector debido a un error en una bd remota con MariaDB 10.10, supuestamente haciendo el cambio a MysqlConnector mis problemas se resolverian pero ahora cuando ejecuto mi programa recibo este error

System.TypeInitializationException
HResult=0x80131534
Mensaje = Se produjo una excepción en el inicializador de tipo de 'MySqlConnector.Logging.MySqlConnectorLoggingConfiguration'.
Origen = MySqlConnector
Seguimiento de la pila:
at MySqlConnector.Logging.MySqlConnectorLoggingConfiguration.get_GlobalConfiguration()
at MySqlConnector.MySqlConnection..ctor(String connectionString)
at Ventas.Base.ObtenerConexion() in C:\Users\HP\Desktop\El bueno\Ventas\Ventas\Base.cs:line 32
at Ventas.Base.AutentificarUser(String NomUsuario, String Password) in C:\Users\HP\Desktop\El bueno\Ventas\Ventas\Base.cs:line 69
at Ventas.Inicio.btnEntrar_Click(Object sender, EventArgs e) in C:\Users\HP\Desktop\El bueno\Ventas\Ventas\Inicio.cs:line 53
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.PerformClick()
at System.Windows.Forms.Form.ProcessDialogKey(Keys keyData)
at System.Windows.Forms.Control.ProcessDialogKey(Keys keyData)
at System.Windows.Forms.Control.ProcessDialogKey(Keys keyData)
at System.Windows.Forms.Control.PreProcessMessage(Message& msg)
at System.Windows.Forms.Control.PreProcessControlMessageInternal(Control target, Message& msg)
at System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG& msg)
at System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FPreTranslateMessage(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Ventas.Program.Main() in C:\Users\HP\Desktop\El bueno\Ventas\Ventas\Program.cs:line 19

Esta excepción se generó originalmente en esta pila de llamadas:

Excepción interna 1:
FileLoadException: No se puede cargar el archivo o ensamblado 'Microsoft.Extensions.Logging.Abstractions, Version=7.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60' ni una de sus dependencias. La definición del manifiesto del ensamblado no coincide con la referencia al ensamblado. (Excepción de HRESULT: 0x80131040)

Veo que es tema de versiones pero, al yo actualizar a la version que me comenta el error, me vuelve a surgir un nuevo error de otro componente de mi cong¡fig.package, y sigo sin encontrar solucion, estoy trabajando con .Net Framework 4.7.2, alguien puede ayudarme?, adicional dejo mi package config que es donde tambien en donde en otros paquetes me marcan error <?xml version="1.0" encoding="utf-8"?> <packages> <package id="BouncyCastle.Cryptography" version="2.2.1" targetFramework="net472" /> <package id="DocX" version="2.0.0" targetFramework="net472" /> <package id="Google.Protobuf" version="3.25.1" targetFramework="net472" /> <package id="K4os.Compression.LZ4" version="1.3.5" targetFramework="net472" /> <package id="K4os.Compression.LZ4.Streams" version="1.3.5" targetFramework="net472" /> <package id="K4os.Hash.xxHash" version="1.0.8" targetFramework="net472" /> <package id="Microsoft.Bcl.AsyncInterfaces" version="8.0.0" targetFramework="net472" /> <package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="8.0.0" targetFramework="net472" /> <package id="Microsoft.Extensions.Logging.Abstractions" version="8.0.0" targetFramework="net472" /> <package id="MySqlConnector" version="2.3.5" targetFramework="net472" /> <package id="System.Buffers" version="4.5.1" targetFramework="net48" /> <package id="System.Configuration.ConfigurationManager" version="4.4.1" targetFramework="net472" /> <package id="System.Diagnostics.DiagnosticSource" version="8.0.0" targetFramework="net472" /> <package id="System.IO.Pipelines" version="5.0.2" targetFramework="net472" /> <package id="System.Memory" version="4.5.5" targetFramework="net472" /> <package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net48" /> <package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net472" /> <package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net472" /> <package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" /> <package id="ZstdSharp.Port" version="0.7.1" targetFramework="net472" /> </packages>

You must be logged in to vote

Replies: 1 comment · 4 replies

Comment options

FileLoadException: Unable to load the 'Microsoft.Extensions.Logging.Abstractions, Version=7.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60' file or assembly or one of its dependencies.

This is almost certainly an assembly binding redirect problem. Check your web.config and add/edit the assembly binding redirect for Microsoft.Extensions.Logging.Abstractions. It may look something like this:

	<dependentAssembly>
		<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
		<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
	</dependentAssembly>

Note that you'll have to use the newVersion that matches the DLL being copied to your bin folder.

You must be logged in to vote
4 replies
@sistemasIHS
Comment options

No tengo web.config pues es una aplicacio de escritorio, pero en mi app.config veo todo correcto

@bgrainger
Comment options

Well.. if your app.config were correct, you wouldn't get this exception, so it must not be correct. What does it contain?

@sistemasIHS
Comment options

this
<?xml version="1.0" encoding="utf-8"?> <configuration> <configSections> <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <section name="Ventas.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/> </sectionGroup> </configSections> <connectionStrings> <add name="Ventas.Properties.Settings.VentasIHSConnectionString" connectionString="Data Source=server;port=3306;Initial Catalog=u730;User Id=id;password=pass;SslMode=none;" providerName="MySqlConnector" /> </connectionStrings> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/> </startup> <userSettings> <Ventas.Properties.Settings> <setting name="NotificacionVista" serializeAs="String"> <value>False</value> </setting> <setting name="SaveHour" serializeAs="String"> <value /> </setting> <setting name="TotalRows" serializeAs="String"> <value>0</value> </setting> </Ventas.Properties.Settings> </userSettings> </configuration>

@bgrainger
Comment options

You are missing the assembly binding redirects. Read and apply https://learn.microsoft.com/en-us/dotnet/framework/configure-apps/redirect-assembly-versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.