.NET: Microsoft Technologies based on the .NET software framework. Runtime: An environment required to run apps that aren't compiled to machine language.
Hello @Aman Agrahari ,
This might be happening because when Oracle Client 19c is installed, its installer appears to automatically configure machine-wide settings and the GAC. Because the .NET Framework generally loads machine.config first and checks the GAC before local assemblies, defining the oracle.manageddataaccess.client section again in your .exe.config likely triggers a duplicate section exception, causing the crash.
I would suggest some approaches to help your application run reliably regardless of the host machine's Oracle Client status:
- Remove the
<section>declaration: Try deleting<section name="oracle.manageddataaccess.client"...>from your.exe.configentirely. Since the .NET Framework requires section names to be unique across the configuration hierarchy, removing it can help prevent the duplication error. - Keep the
<DbProviderFactories>tags: What you did here aligns with Microsoft's design. Using the<remove invariant="..." />tag is the standard Microsoft .NET mechanism for clearing inherited collection settings to safely override machine-level configurations. - Configure via code: If you rely on specific Oracle settings (like
TNS_ADMIN), you might consider setting them programmatically using the OracleConfiguration class at application startup. Oracle provides this class specifically to handle settings in code, which can help decouple your app from XML files and any existing machine-level setups.
Disclaimer: Some links are non-Microsoft website. The pages appear to be providing accurate, safe information. Watch out for ads on the site that may advertise products frequently classifies as a PUP (Potentially Unwanted Products). Thoroughly research any product advertised on the site before you decide to download and install it.
I hope this helps with your question. If you found my response helpful, please follow this guide to provide feedback.
Thank you.