I have a project using ODP.Net version 12.2.1100. This project was working fine until opening today. The following line of code is causing the error:
using (var cn = new OracleConnection("User Name={userID}, etc, etc"))
The error being returned is:
Value cannot be null.
Parameter name: path
Inner exception
at System.Security.Permissions.FileIOPermission.CheckIllegalCharacters(String[] str, Boolean onlyCheckExtras)
Things I have tried so far to resolve the issue:
Changed connection string from EZ Connect to full Oracle string
Uninstalled and resintalled Oracle.ManagedDataAccess.dll (through NuGet)
Ensured all config files were up to date
Created a new simple test console project (which connected fine)
I had the same issue. It occurred also with the Managed Data Provider and it happens with the first Oracle class that gets instantiated, e.g. OracleParameter. But it only happens in the debugger of a unit test or in other cases where Assembly.GetEntryAssembly() returns null.
The call stack of the error gave me a hint: It calls System.Web.HttpRuntime.AppDomainAppPath. This throws the exception. By looking at the Oracle code I found a try-catch around it that should catch the exception but for some reason that sometimes fails.
In another project I get the same exception but this time it gets caught before it hits my code. Strange.
The following work around works for me:
try
{
new OracleDependency();
}
catch
{
}
This triggers the static constructor of ConfigBaseClass and ignores the error. It is sufficient to call this once in your code, e.g. also in a static constructor. I used OracleDependency as it doesn't require a Dispose as most other Oracle classes.
So next on my list was checking in my project and asking a colleague to open it to determine if the problem travelled with the code. He was able to execute successfully. I deleted my working copy and pulled it down from TFS, everything started working again. I suspect that something was corrupt in the bin directory.
I got this error in my integration test project. After deleting the bin folder and rebuilding, the error disappeared.
Related
Issue: On my development machine, everything works fine. However, when I copy the executable to the server, my program doesn't start
What I've done so far: I checked the event viewer and the error stack looks like this:
Application: Project.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Configuration.ConfigurationErrorsException
Stack:
at System.Configuration.ClientConfigurationSystem.EnsureInit(System.String)
at System.Configuration.ClientConfigurationSystem.PrepareClientConfigSystem(System.String)
at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(System.String)
at System.Configuration.ConfigurationManager.GetSection(System.String)
at System.Configuration.ConfigurationManager.get_ConnectionStrings()
at Project.BaseService..ctor()
at Project.Service..ctor()
at Project.Program.Main()
I checked online and, most of the times, this error is generated by some misplacement of configSections on the .config files. To make sure this was not the case, I let both app.config and .exe.config files clean (only the section was there), but my program still didn't work.
Then, I generated a dump file from the failing process and here is where things get strange: the exception that is thrown when I'm calling ConfigurationManager.ConnectionStrings is "Configuration System failed to initialize", with a "The 'add' start tag on line 257 position 6 does not match the end tag of 'connectionManagement'. Line 258, position 3." inner exception. I double-checked my entire project and there is not a single reference to "connectionManagement" anywhere! I even tried to check AppDomain.CurrentDomain.SetupInformation.ConfigurationFile's value and it indicates the right config file.
By fixing this connectionManagement issue I'll probably be able to run my application, but do you guys have any idea about where this might be coming from?
Problem was on the machine.config file on the server. Changing it solved the problem!
I use EF5 over SQLite database (using System.Data.SQLite 1.0.90.0). The entities are exposed via OData service
public sealed class MyService : DataService<MyEntities>
When I query my entities from inside my app it works ok, for example
using (var ents = new MyEntities)
{
var count = ents.SomeEntity.Select(ent => ent).Count();
}
When I send a request from browser like this
http://localhost:8737/MyService/SomeEntity
it also works fine, it returns me the list of my entities.
But when I create a following request
http://localhost:8737/MyService/SomeEntity/$count
OR
I query the service by service reference from some client app (and my query contains Count()), I get an Exception
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Data.EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details. ---> System.Data.SQLite.SQLiteException: SQL logic error or missing database
no such function: BigCount
I suppose that when the SQL request is generated it contains aggregate function BIGCOUNT which SQLite doesn't have. If I change my database provider to SQL Server, then everything is absolutely fine. I don't know what I can do to change the way the request is generated. I tried to switch to Entity Framework 6 + System.Data.SQLite 1.0.94.0 but it's no use. I tried to stick to EF5 and change the versions of System.Data.SQLite to previous ones but nothing changed. The only difference I had was that my earlier problem was "solved" (in quotes because I would not call something I don't understand a solution) when I used the EF6+SQLITE1.0.94.0.
UPDATE 23/12/2014
We solved this problem by examining the System.Data.SQLite sources, finding the place where the "bigcount" keyword was incorrectly used, fixing it for our needs and then rebuilding the library.
As stated here the BigCount should be compiled to COUNT() in all databases except SQL Server. It looks like BigCount was compiled just to BigCount, or sth like that.
Rebuilding the library turned to be tricky itself, and since I'm only a little Junior yet, so my Team Lead did that part and I can't tell the details, which I didn't have time to dive deeper in. At least, it's a direction you can use to solve the same problem.
I also encountered the error SQL logic error or missing database\r\nno such function: BigCount and here are the detailed step-by-step instructions I used to update the code to resolve the issue on a Windows operating system:
Download fossil and extract fossil.exe to your <working> directory
Open a normal command prompt
Run cd <working>
Run fossil clone https://system.data.sqlite.org/ sds.fossil
Run fossil open sds.fossil
Run fossil update <release-tag>
For example, fossil update release-1.0.105.2
Update .\System.Data.SQLite.Linq\SQL Generation\SqlGenerator.cs:
a. un-comment lines 1978 - 1983
b. replace line 1982 with the following line:
aggregateResult.Append("COUNT");
Run cd Setup
Run set_YYYY.bat
For example, to build the net451 binaries, run set_2013.bat
Run build.bat ReleaseManagedOnly
Remove the references to System.Data.SQLite.Linq and System.Data.SQLite.EF6 from the ASP.NET Web project
Add references to the new System.Data.SQLite.Linq.dll and System.Data.SQLite.EF6.dll from <working>\bin\2013\Release\bin in the ASP.NET Web project
Sources:
System.Data.SQLite Source Code
System.Data.SQLite Build Procedures
System.Data.SQLite Ticket UUID 76c2eaadc0297696b2c5fb10d41a22325f56f9b9
I have installed a software ABCPDF7, which converts a html file to pdf and saves it.
I am facing an error:
ERROR MESSAGE :The type initializer for 'WebSupergoo.ABCpdf7.Internal.NDoc' threw an exception. ERROR DETAILS : at WebSupergoo.ABCpdf7.Internal.NDoc.New() at WebSupergoo.ABCpdf7.Doc..ctor()
on line :
WebSupergoo.ABCpdf7.Doc oDoc = new WebSupergoo.ABCpdf7.Doc();
======
This error is coming in one old application.
So for cross checking I did create a dummy app, and executed the code in same box and everything worked fine.
Any idea where is it failing in existing app?
ABCpdf7 requires two DLLs to be accessible: ABCPDF.DLL and ABCPDFCE7.DLL. Both must be the same version (down to the minor release number) and also must both match the bitness of the machine they are running on (32-bit or 64-bit).
Perhaps one of the DLLs in the old application is incorrect.
If you are facing this issue after Deployment , The issue could be Application Pool . It need to be configured to enable 32 bit Application . Please see attached (Embedded) Screenshot:
https://i.stack.imgur.com/MkZpA.png
Our team got into work in the morning and we found that all of our Watin (2.1.0) tests were failing on our integration server with the following exception. The tests also no longer work locally against (IE8 or IE9)
WatiN.Core.Exceptions.RunScriptException : RunScript failed
----> System.UnauthorizedAccessException : Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
Note, that this error message is occuring when a list box jquery change event is being fired:
self.$country.bind('change', function (e) {
var country = $('option:selected', this);
if(country.val() == "??")
{
self.$country.val('US');
}
We are at a complete loss as:
We have tried reverting all code changes prior to test failure and they errors do not appear to be related
These tests have been running successfully for several months
No windows updates have been applied to the server
Network permissions have not been changed
Any insight into this error or suggestions would be greatly appreciated.
For references, we fixed this issue by adding the test site to the IE's trusted sites list and it has resolved the error message. Similar issue is here for reference: stackoverflow.com/questions/3986477/…
I have also run into this problem a lot of times, but in my case it occurred only when the element that was being manipulated was disabled.
Are you facing this problem even when you are running the test in DEBUG mode or is it only when you are running it as part of the suite with a test runner.
You might want to run the test in Visual Studio with the debugger attached and check the properties of the element that is being manipulated in the Quick Watch window. The exact line where the exception is thrown will be available in the Stack Trace where you are getting this exception.
Regards,
Ashish Narmen
I'm creating a custom powershell 1.0 cmdlet that will allow me to feed exceptions from powershell scripts to the Microsoft Enterprise Library v5.0 exception handling block.
I load up my Exception handling config from an external file since the cmdlet is compiled into a dll, and then try to create an instance of ExceptionManager using the config.
Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource config =
new Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource(configFile);
WriteDebug("Config loaded from " + Path.GetFullPath(configFile));
EnterpriseLibraryContainer.Current = EnterpriseLibraryContainer.CreateDefaultContainer(config);
exManager = EnterpriseLibraryContainer.CreateDefaultContainer(config).GetInstance<ExceptionManager>();
This fails when I call my command from powershell with the following error:
Microsoft.Practices.ServiceLocation.ActivationException: Activation error occured while trying to get instance of type ExceptionManager, key "" ---> Microsoft.Practices.Unity.ResolutionFailedException: Resolution of the dependency failed, type = "Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionManager", name = "(none)".
Exception occurred while: while resolving. Exception is: InvalidOperationException - The type ExceptionManager cannot be constructed. You must configure the container to supply this value.
The frustrating thing is that the code works perfectly fine when used in a stand-alone console application with the exact same configuration. I'm not really sure why I'm getting this error; I've made sure that I'm using the same assemblies that are referenced in the config file and I've made sure that I'm referencing all the necessary enterprise library dlls in my project.
Additionally, I've had to copy the Enterprise Library dlls into the powershell install directory (%SystemRoot%\system32\WindowsPowerShell\v1.0), otherwise I would receive FileNotFoundExceptions about not being able to find the correct library while the configuration file was being processed. I don't have too much experience with powershell or enterprise library, but I'm guessing that this might be resolved by playing around with AppDomain settings.
Turns out I wasn't giving an absolute path to my configuration file, which was causing weirdness. I originally just set it to "widgit.dll.config", and threw it under %systemroot%\System32, since that's the default working directory of my powershell, and seemed to get rid of the initial "file not found" errors I was having (didn't want to change the working directory until I understood the entire problem). On a hunch, I copied the config into the powershell directory and renamed it powershell.exe.config, and that solved my other problem.
Putting stuff into system directories isn't the most elegant solution at this point, but it's sufficient for my current problem.