Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect Exception - Could not find FirebirdSql.Data.FirebirdClient.resources [DNET488] #474

Closed
firebird-automations opened this issue Mar 2, 2013 · 8 comments

Comments

@firebird-automations
Copy link

Submitted by: Manfred Roßkamp (manni)

Attachments:
MyApp.7z

If you cause an exception for example with the following incorrect sql statement:
"select date() from xy"
I get the following exception:
{"Die Datei \"FirebirdSql.Data.FirebirdClient.resources\" konnte nicht gefunden werden.":null}
(Look at the end of this description for the stacktrace)

In my environment i have the following folder structure:

MyApp.exe
Firebird\x32\FirebirdSql.Data.FirebirdClient.dll
Firebird\x32\*(32 bit Firebird embedded Version)
Firebird\x64\FirebirdSql.Data.FirebirdClient.dll
Firebird\x64\*(64 bit Firebird embedded Version)

MyApp is compiled in AnyCPU and it load's dynamically the FirebirdSql.Data.FirebirdClient.dll from the correct subfolder.

I solved this problem with the following changes in FirebirdSql.Data.Common.IscException
1. Add the following method to get the correct resource set:

	#⁠region \-  Statics \- 

	private static Dictionary<string, ResourceSet\> resources = new Dictionary<string, ResourceSet\>\(\);

	private static ResourceSet GetResourceSet\(string name\)
	\{
		ResourceSet result;

		if \(\!resources\.TryGetValue\(name, out result\)\)
		\{
			using \(var resStream = Assembly\.GetExecutingAssembly\(\)\.GetManifestResourceStream\(
				name \+ "\.resources"\)\)
			\{
				result = new ResourceSet\(resStream\);
				resources\[name\] = result;
			\}
		\}

		return result;
	\}

	#&#x2060;endregion

2. Call the specified method instead of creating a new ResourceManager
a. In the method BuildSqlState():
var rm = GetResourceSet("FirebirdSql.Resources.sqlstate_mapping");
this.SQLSTATE = rm.GetString(this.ErrorCode.ToString());
b. In the method BuildExceptionMessage():
StringBuilder builder = new StringBuilder();
var rm = GetResourceSet("FirebirdSql.Resources.isc_error_msg");

stacktrace:
bei System.Reflection.RuntimeAssembly.InternalGetSatelliteAssembly(String name, CultureInfo culture, Version version, Boolean throwOnFileNotFound, StackCrawlMark& stackMark)
bei System.Resources.ManifestBasedResourceGroveler.GetSatelliteAssembly(CultureInfo lookForCulture, StackCrawlMark& stackMark)
bei System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo culture, Dictionary`2 localResourceSets, Boolean tryParents, Boolean createIfNotExists, StackCrawlMark& stackMark)
bei System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo requestedCulture, Boolean createIfNotExists, Boolean tryParents, StackCrawlMark& stackMark)
bei System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
bei System.Resources.ResourceManager.GetString(String name, CultureInfo culture)
bei System.Resources.ResourceManager.GetString(String name)
bei FirebirdSql.Data.Common.IscException.BuildSqlState()
bei FirebirdSql.Data.Common.IscException.BuildExceptionData()
bei FirebirdSql.Data.Client.Native.FesConnection.ParseStatusVector(IntPtr[] statusVector, Charset charset)
bei FirebirdSql.Data.Client.Native.FesDatabase.ParseStatusVector(IntPtr[] statusVector)
bei FirebirdSql.Data.Client.Native.FesStatement.Prepare(String commandText)
bei FirebirdSql.Data.FirebirdClient.FbCommand.Prepare(Boolean returnsSet)
bei FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteCommand(CommandBehavior behavior, Boolean returnsSet)
bei FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteReader(CommandBehavior behavior)
bei FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteDbDataReader(CommandBehavior behavior)

Commits: f407579

@firebird-automations
Copy link
Author

Modified by: Manfred Roßkamp (manni)

description: If you cause an exception for example with the following incorrect sql statement:
"select date() from xy"
I get the following exception:
{"Die Datei \"FirebirdSql.Data.FirebirdClient.resources\" konnte nicht gefunden werden.":null}
(Look at the end of this description for the stacktrace)

In my environment i have the following dictionary structure:

MyApp.exe
Firebird\x32\FirebirdSql.Data.FirebirdClient.dll
Firebird\x32\*(32 bit Firebird embedded Version)
Firebird\x64\FirebirdSql.Data.FirebirdClient.dll
Firebird\x64\*(64 bit Firebird embedded Version)

MyApp is compiled in AnyCPU and it load's dynamically the FirebirdSql.Data.FirebirdClient.dll from the correct subfolder.

I solved this problem with the following changes in FirebirdSql.Data.Common.IscException
1. Add the following method to get the correct resource set:

	#&#x2060;region \-  Statics \- 

	private static Dictionary<string, ResourceSet\> resources = new Dictionary<string, ResourceSet\>\(\);

	private static ResourceSet GetResourceSet\(string name\)
	\{
		ResourceSet result;

		if \(\!resources\.TryGetValue\(name, out result\)\)
		\{
			using \(var resStream = Assembly\.GetExecutingAssembly\(\)\.GetManifestResourceStream\(
				name \+ "\.resources"\)\)
			\{
				result = new ResourceSet\(resStream\);
				resources\[name\] = result;
			\}
		\}

		return result;
	\}

	#&#x2060;endregion

2. Call the specified method instead of creating a new ResourceManager

at
bei System.Reflection.RuntimeAssembly.InternalGetSatelliteAssembly(String name, CultureInfo culture, Version version, Boolean throwOnFileNotFound, StackCrawlMark& stackMark)
bei System.Resources.ManifestBasedResourceGroveler.GetSatelliteAssembly(CultureInfo lookForCulture, StackCrawlMark& stackMark)
bei System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo culture, Dictionary`2 localResourceSets, Boolean tryParents, Boolean createIfNotExists, StackCrawlMark& stackMark)
bei System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo requestedCulture, Boolean createIfNotExists, Boolean tryParents, StackCrawlMark& stackMark)
bei System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
bei System.Resources.ResourceManager.GetString(String name, CultureInfo culture)
bei System.Resources.ResourceManager.GetString(String name)
bei FirebirdSql.Data.Common.IscException.BuildSqlState()
bei FirebirdSql.Data.Common.IscException.BuildExceptionData()
bei FirebirdSql.Data.Client.Native.FesConnection.ParseStatusVector(IntPtr[] statusVector, Charset charset)
bei FirebirdSql.Data.Client.Native.FesDatabase.ParseStatusVector(IntPtr[] statusVector)
bei FirebirdSql.Data.Client.Native.FesStatement.Prepare(String commandText)
bei FirebirdSql.Data.FirebirdClient.FbCommand.Prepare(Boolean returnsSet)
bei FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteCommand(CommandBehavior behavior, Boolean returnsSet)
bei FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteReader(CommandBehavior behavior)
bei FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteDbDataReader(CommandBehavior behavior)

=>

If you cause an exception for example with the following incorrect sql statement:
"select date() from xy"
I get the following exception:
{"Die Datei \"FirebirdSql.Data.FirebirdClient.resources\" konnte nicht gefunden werden.":null}
(Look at the end of this description for the stacktrace)

In my environment i have the following dictionary structure:

MyApp.exe
Firebird\x32\FirebirdSql.Data.FirebirdClient.dll
Firebird\x32\*(32 bit Firebird embedded Version)
Firebird\x64\FirebirdSql.Data.FirebirdClient.dll
Firebird\x64\*(64 bit Firebird embedded Version)

MyApp is compiled in AnyCPU and it load's dynamically the FirebirdSql.Data.FirebirdClient.dll from the correct subfolder.

I solved this problem with the following changes in FirebirdSql.Data.Common.IscException
1. Add the following method to get the correct resource set:

	#&#x2060;region \-  Statics \- 

	private static Dictionary<string, ResourceSet\> resources = new Dictionary<string, ResourceSet\>\(\);

	private static ResourceSet GetResourceSet\(string name\)
	\{
		ResourceSet result;

		if \(\!resources\.TryGetValue\(name, out result\)\)
		\{
			using \(var resStream = Assembly\.GetExecutingAssembly\(\)\.GetManifestResourceStream\(
				name \+ "\.resources"\)\)
			\{
				result = new ResourceSet\(resStream\);
				resources\[name\] = result;
			\}
		\}

		return result;
	\}

	#&#x2060;endregion

2. Call the specified method instead of creating a new ResourceManager
a. In the method BuildSqlState():
var rm = GetResourceSet("FirebirdSql.Resources.sqlstate_mapping");
this.SQLSTATE = rm.GetString(this.ErrorCode.ToString());
b. In the method BuildExceptionMessage():
StringBuilder builder = new StringBuilder();
var rm = GetResourceSet("FirebirdSql.Resources.isc_error_msg");

stacktrace:
bei System.Reflection.RuntimeAssembly.InternalGetSatelliteAssembly(String name, CultureInfo culture, Version version, Boolean throwOnFileNotFound, StackCrawlMark& stackMark)
bei System.Resources.ManifestBasedResourceGroveler.GetSatelliteAssembly(CultureInfo lookForCulture, StackCrawlMark& stackMark)
bei System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo culture, Dictionary`2 localResourceSets, Boolean tryParents, Boolean createIfNotExists, StackCrawlMark& stackMark)
bei System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo requestedCulture, Boolean createIfNotExists, Boolean tryParents, StackCrawlMark& stackMark)
bei System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
bei System.Resources.ResourceManager.GetString(String name, CultureInfo culture)
bei System.Resources.ResourceManager.GetString(String name)
bei FirebirdSql.Data.Common.IscException.BuildSqlState()
bei FirebirdSql.Data.Common.IscException.BuildExceptionData()
bei FirebirdSql.Data.Client.Native.FesConnection.ParseStatusVector(IntPtr[] statusVector, Charset charset)
bei FirebirdSql.Data.Client.Native.FesDatabase.ParseStatusVector(IntPtr[] statusVector)
bei FirebirdSql.Data.Client.Native.FesStatement.Prepare(String commandText)
bei FirebirdSql.Data.FirebirdClient.FbCommand.Prepare(Boolean returnsSet)
bei FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteCommand(CommandBehavior behavior, Boolean returnsSet)
bei FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteReader(CommandBehavior behavior)
bei FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteDbDataReader(CommandBehavior behavior)

@firebird-automations
Copy link
Author

Modified by: Manfred Roßkamp (manni)

description: If you cause an exception for example with the following incorrect sql statement:
"select date() from xy"
I get the following exception:
{"Die Datei \"FirebirdSql.Data.FirebirdClient.resources\" konnte nicht gefunden werden.":null}
(Look at the end of this description for the stacktrace)

In my environment i have the following dictionary structure:

MyApp.exe
Firebird\x32\FirebirdSql.Data.FirebirdClient.dll
Firebird\x32\*(32 bit Firebird embedded Version)
Firebird\x64\FirebirdSql.Data.FirebirdClient.dll
Firebird\x64\*(64 bit Firebird embedded Version)

MyApp is compiled in AnyCPU and it load's dynamically the FirebirdSql.Data.FirebirdClient.dll from the correct subfolder.

I solved this problem with the following changes in FirebirdSql.Data.Common.IscException
1. Add the following method to get the correct resource set:

	#&#x2060;region \-  Statics \- 

	private static Dictionary<string, ResourceSet\> resources = new Dictionary<string, ResourceSet\>\(\);

	private static ResourceSet GetResourceSet\(string name\)
	\{
		ResourceSet result;

		if \(\!resources\.TryGetValue\(name, out result\)\)
		\{
			using \(var resStream = Assembly\.GetExecutingAssembly\(\)\.GetManifestResourceStream\(
				name \+ "\.resources"\)\)
			\{
				result = new ResourceSet\(resStream\);
				resources\[name\] = result;
			\}
		\}

		return result;
	\}

	#&#x2060;endregion

2. Call the specified method instead of creating a new ResourceManager
a. In the method BuildSqlState():
var rm = GetResourceSet("FirebirdSql.Resources.sqlstate_mapping");
this.SQLSTATE = rm.GetString(this.ErrorCode.ToString());
b. In the method BuildExceptionMessage():
StringBuilder builder = new StringBuilder();
var rm = GetResourceSet("FirebirdSql.Resources.isc_error_msg");

stacktrace:
bei System.Reflection.RuntimeAssembly.InternalGetSatelliteAssembly(String name, CultureInfo culture, Version version, Boolean throwOnFileNotFound, StackCrawlMark& stackMark)
bei System.Resources.ManifestBasedResourceGroveler.GetSatelliteAssembly(CultureInfo lookForCulture, StackCrawlMark& stackMark)
bei System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo culture, Dictionary`2 localResourceSets, Boolean tryParents, Boolean createIfNotExists, StackCrawlMark& stackMark)
bei System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo requestedCulture, Boolean createIfNotExists, Boolean tryParents, StackCrawlMark& stackMark)
bei System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
bei System.Resources.ResourceManager.GetString(String name, CultureInfo culture)
bei System.Resources.ResourceManager.GetString(String name)
bei FirebirdSql.Data.Common.IscException.BuildSqlState()
bei FirebirdSql.Data.Common.IscException.BuildExceptionData()
bei FirebirdSql.Data.Client.Native.FesConnection.ParseStatusVector(IntPtr[] statusVector, Charset charset)
bei FirebirdSql.Data.Client.Native.FesDatabase.ParseStatusVector(IntPtr[] statusVector)
bei FirebirdSql.Data.Client.Native.FesStatement.Prepare(String commandText)
bei FirebirdSql.Data.FirebirdClient.FbCommand.Prepare(Boolean returnsSet)
bei FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteCommand(CommandBehavior behavior, Boolean returnsSet)
bei FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteReader(CommandBehavior behavior)
bei FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteDbDataReader(CommandBehavior behavior)

=>

If you cause an exception for example with the following incorrect sql statement:
"select date() from xy"
I get the following exception:
{"Die Datei \"FirebirdSql.Data.FirebirdClient.resources\" konnte nicht gefunden werden.":null}
(Look at the end of this description for the stacktrace)

In my environment i have the following folder structure:

MyApp.exe
Firebird\x32\FirebirdSql.Data.FirebirdClient.dll
Firebird\x32\*(32 bit Firebird embedded Version)
Firebird\x64\FirebirdSql.Data.FirebirdClient.dll
Firebird\x64\*(64 bit Firebird embedded Version)

MyApp is compiled in AnyCPU and it load's dynamically the FirebirdSql.Data.FirebirdClient.dll from the correct subfolder.

I solved this problem with the following changes in FirebirdSql.Data.Common.IscException
1. Add the following method to get the correct resource set:

	#&#x2060;region \-  Statics \- 

	private static Dictionary<string, ResourceSet\> resources = new Dictionary<string, ResourceSet\>\(\);

	private static ResourceSet GetResourceSet\(string name\)
	\{
		ResourceSet result;

		if \(\!resources\.TryGetValue\(name, out result\)\)
		\{
			using \(var resStream = Assembly\.GetExecutingAssembly\(\)\.GetManifestResourceStream\(
				name \+ "\.resources"\)\)
			\{
				result = new ResourceSet\(resStream\);
				resources\[name\] = result;
			\}
		\}

		return result;
	\}

	#&#x2060;endregion

2. Call the specified method instead of creating a new ResourceManager
a. In the method BuildSqlState():
var rm = GetResourceSet("FirebirdSql.Resources.sqlstate_mapping");
this.SQLSTATE = rm.GetString(this.ErrorCode.ToString());
b. In the method BuildExceptionMessage():
StringBuilder builder = new StringBuilder();
var rm = GetResourceSet("FirebirdSql.Resources.isc_error_msg");

stacktrace:
bei System.Reflection.RuntimeAssembly.InternalGetSatelliteAssembly(String name, CultureInfo culture, Version version, Boolean throwOnFileNotFound, StackCrawlMark& stackMark)
bei System.Resources.ManifestBasedResourceGroveler.GetSatelliteAssembly(CultureInfo lookForCulture, StackCrawlMark& stackMark)
bei System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo culture, Dictionary`2 localResourceSets, Boolean tryParents, Boolean createIfNotExists, StackCrawlMark& stackMark)
bei System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo requestedCulture, Boolean createIfNotExists, Boolean tryParents, StackCrawlMark& stackMark)
bei System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
bei System.Resources.ResourceManager.GetString(String name, CultureInfo culture)
bei System.Resources.ResourceManager.GetString(String name)
bei FirebirdSql.Data.Common.IscException.BuildSqlState()
bei FirebirdSql.Data.Common.IscException.BuildExceptionData()
bei FirebirdSql.Data.Client.Native.FesConnection.ParseStatusVector(IntPtr[] statusVector, Charset charset)
bei FirebirdSql.Data.Client.Native.FesDatabase.ParseStatusVector(IntPtr[] statusVector)
bei FirebirdSql.Data.Client.Native.FesStatement.Prepare(String commandText)
bei FirebirdSql.Data.FirebirdClient.FbCommand.Prepare(Boolean returnsSet)
bei FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteCommand(CommandBehavior behavior, Boolean returnsSet)
bei FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteReader(CommandBehavior behavior)
bei FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteDbDataReader(CommandBehavior behavior)

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: Open [ 1 ] => In Progress [ 3 ]

@firebird-automations
Copy link
Author

Commented by: @cincuranet

Please provide a test-case.

@firebird-automations
Copy link
Author

Commented by: Manfred Roßkamp (manni)

I add a test project that shows the bug.

@firebird-automations
Copy link
Author

Modified by: Manfred Roßkamp (manni)

Attachment: MyApp.7z [ 12363 ]

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: In Progress [ 3 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: vNext [ 10587 ]

@firebird-automations
Copy link
Author

Modified by: @cincuranet

Fix Version: 4.1.5.0 [ 10590 ]

Fix Version: vNext [ 10587 ] =>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants