Method not found: ScriptProgressEventArgs.get_Length()
Method not found: ScriptProgressEventArgs.get_Length()
We are developing in Visual Studio 2017, C#, .NET 4.51. We recently updated dotConnect for Oracle to 9.5.502.0 and now receive an error when executing a script using an OracleScript instance.
The error is "Method not found: ScriptProgressEventArgs.get_Length()". I have looked at the meta data for the ScriptProgressEventArgs class, and the Length property is defined as int. I have set a break point in my event handler and examined the event args instance, and could successfully read the Length property in the debugger. I also looked at the call stack of the exception, but it stops at the line of code where we OracleScript.Execute(). I had one of my developers manually execute the SQL that was assigned to the OracleScript, and it completed successfully.
What do you recommend I do now to resolve this issue?
The error is "Method not found: ScriptProgressEventArgs.get_Length()". I have looked at the meta data for the ScriptProgressEventArgs class, and the Length property is defined as int. I have set a break point in my event handler and examined the event args instance, and could successfully read the Length property in the debugger. I also looked at the call stack of the exception, but it stops at the line of code where we OracleScript.Execute(). I had one of my developers manually execute the SQL that was assigned to the OracleScript, and it completed successfully.
What do you recommend I do now to resolve this issue?
Re: Method not found: ScriptProgressEventArgs.get_Length()
We cannot reproduce the issue at the moment. Please specify:
1. How should we modify this code for reproducing?
2. Give us your connection string (roughly, without credentials).
3. Are you using .NET Framework (shipped with installation) or .NET Standard (available via NuGet) Devart.* assemblies?
1. How should we modify this code for reproducing?
Code: Select all
class Program
{
static void Main(string[] args)
{
using (var conn = new OracleConnection("your_connection_string"))
{
conn.Open();
OracleScript script = new OracleScript("create table new_table (id number primary key); insert into new_table values (1);", conn);
script.Progress += Script_Progress;
script.Execute();
}
}
private static void Script_Progress(object sender, Devart.Common.ScriptProgressEventArgs e)
{
Console.WriteLine(e.Length);
}
}
3. Are you using .NET Framework (shipped with installation) or .NET Standard (available via NuGet) Devart.* assemblies?
Re: Method not found: ScriptProgressEventArgs.get_Length()
Below is an example that generates the error on our system, when using valid User ID, Password, etc. This example has been reconstructed using actual code snippets from several methods in our application. These snippets have been stitched together into a single method to demonstrate the issue. In our case the user "AAAAA" has DBA privileges, and is attempting to grant the privileges temporarily to standard user "EEEEE". And, we are using the .NET Framework assemblies from the installation. Also, the SqlStatementExecute event is successfully raised (execution will pause at a break point set in that event handler method, and the Length property of the SqlStatementExecuteEventArgs can be viewed while debugging), but the exception occurs before the Progress event is raised.
Please let me know if you need any further information.
Code: Select all
class Program
{
static void Main(string[] args)
{
using (var conn = new OracleConnection("User Id=AAAAA;Password=BBBBB;Server=CCCCC;Connect Mode=SysDba;Pooling=True;Max Pool Size=20;Direct=True;Sid=DDDDD;Port=1525;"))
{
conn.Open();
var sb = new StringBuilder();
sb.AppendLine("{0} \"DBA\" {1} {2};");
sb.AppendLine("grant unlimited tablespace to {2};");
sb.AppendLine("grant select_catalog_role to {2};");
sb.AppendLine("grant execute on dbms_alert to {2};");
sb.AppendLine("alter user {2} default role all;");
string sql = sb.ToString();
sb = new StringBuilder(string.Format(sql, "grant", "to", "EEEEE"));
var script = new OracleScript();
script.Connection = conn;
script.ScriptText = sb.ToString();
script.SqlStatementExecute += Script_SqlStatementExecute;
script.Progress += Script_Progress;
script.Execute();
}
}
private static void Script_SqlStatementExecute(object sender, SqlStatementExecuteEventArgs e)
{
Console.WriteLine(e.Length);
}
private static void Script_Progress(object sender, Devart.Common.ScriptProgressEventArgs e)
{
Console.WriteLine(e.Length);
}
}
Re: Method not found: ScriptProgressEventArgs.get_Length()
Also, I just wrapped the Execute call in a try..catch. Here is the stack trace:
Code: Select all
System.MissingMethodException: Method not found: 'Int32 Devart.Common.ScriptProgressEventArgs.get_Length()'.
at DevArtErrorTest.Program.Script_Progress(Object sender, ScriptProgressEventArgs e)
at Devart.Common.DbScript.OnProgress(SqlStatement stmt)
at Devart.Common.DbScript.a(Boolean A_0, IDataReader& A_1)
at Devart.Common.DbScript.Execute()
at DevArtErrorTest.Program.Main(String[] args) in C:\_Dev.NET\Temp\DevArtErrorTest\Program.cs:line 40
-
- Devart Team
- Posts: 2420
- Joined: Wed 02 Nov 2011 09:44
Re: Method not found: ScriptProgressEventArgs.get_Length()
We could not reproduce the issue. Please deploy your application on another computer, where dotConnect for Oracle is not installed. Is the issue reproduced on this deployment computer? If yes, then send us this complete application with all the assemblies used in this project.
You can archive your project and upload it to our ftp server (ftp://ftp.devart.com, credentials: anonymous/anonymous) or to any file exchange server so that we could download it from there. And send us the password to the archive.
You can archive your project and upload it to our ftp server (ftp://ftp.devart.com, credentials: anonymous/anonymous) or to any file exchange server so that we could download it from there. And send us the password to the archive.
Re: Method not found: ScriptProgressEventArgs.get_Length()
I believe I have discovered the problem. We currently have Devart.Data.dll 5.0.1926.0 and Devart.Data.Oracle.dll 9.5.502.0 installed in the GAC on our development machines. The applications that are receiving the MissingMethodException are build on Devart.Data.dll 5.0.1823.0 and Devart.Data.Oracle.dll 9.5.399.0.
We store the older Devart libraries in version control, along with the code that references them. Our projects contain explicit references to the folder where we store the Devart libraries for version control, and have the Copy Local property set to True. Therefore, the Devart libraries are deployed in the same folder as the applications that use them. I would expect those applications to use the local libraries, regardless of what is installed in the GAC.
We started receiving the MissingMethodException errors when maintaining older versions of our applications after upgrading to 9.5.502.0.
So, to sum up:
Please let me know if you need any further information.
We store the older Devart libraries in version control, along with the code that references them. Our projects contain explicit references to the folder where we store the Devart libraries for version control, and have the Copy Local property set to True. Therefore, the Devart libraries are deployed in the same folder as the applications that use them. I would expect those applications to use the local libraries, regardless of what is installed in the GAC.
We started receiving the MissingMethodException errors when maintaining older versions of our applications after upgrading to 9.5.502.0.
So, to sum up:
- the GAC has newer Devart assemblies installed, which are used when developing the current version of our applications
- maintenance versions use an older version of Devart assemblies
- the appropriate Devart assemblies are deployed in the same folder as the applications
- we receive a MissingMethodException when working on maintenance versions
Please let me know if you need any further information.
-
- Devart Team
- Posts: 2420
- Joined: Wed 02 Nov 2011 09:44
Re: Method not found: ScriptProgressEventArgs.get_Length()
dotConnect for Oracle assemblies are usual .NET Framework assemblies, and they are processed in the same way as the standard Framework ones.
Devart assemblies are strong-named (signed). And if assemblies in the GAC and in your application folder have the same version number, the assemblies from the GAC are always loaded. For more information, please refer to https://social.msdn.microsoft.com/Forum ... 4f5518a6a/
After installing dotConnect for Oracle 9.5.502, your project still references the Devart assemblies from the version 9.5.399, but on your development computer the latest assembly versions are used because of the policy files in the GAC. Each dotConnect for Oracle installation places policy files to GAC. You need to delete the policy.*.Devart.* files from GAC.
Devart assemblies are strong-named (signed). And if assemblies in the GAC and in your application folder have the same version number, the assemblies from the GAC are always loaded. For more information, please refer to https://social.msdn.microsoft.com/Forum ... 4f5518a6a/
After installing dotConnect for Oracle 9.5.502, your project still references the Devart assemblies from the version 9.5.399, but on your development computer the latest assembly versions are used because of the policy files in the GAC. Each dotConnect for Oracle installation places policy files to GAC. You need to delete the policy.*.Devart.* files from GAC.
Re: Method not found: ScriptProgressEventArgs.get_Length()
Deleting all of the policy.##.##.Devart.Data.* folders from the GAC did fix the problem.
This issue has been resolved.
This issue has been resolved.