Help with Redis-Sharp or ServiceStack.Redis - c#

I tried to run Redis-Sharp test program. It sets the string length when I set some key,value (both strings). And while reading the data it throws exception.
I then moved on and tried ServiceStack.Redis and after adding library reference it properly shows the properties of RedisClient etc but when I try to build it throws an error no library reference found. Can anyone help me get past this step and actually see some test programs running proper commands on Redis server ?
Regards,
Lalith

When a new project is created in Visual Studio 2010 the Target framework (on Application tab of project properties) is set to .NET Framework 4 Client Profile; changing this to .NET Framework 4 resolves the RedisClient build problem.

I'm the maintainer of the ServiceStack.Redis client - can I ask which build are you having problems with? i.e. what build references were you missing?
I've currently in the process of moving to GitHub (which is now the official project site of the open source project).
So from now on the latest source code and binary releases will be available here:
https://github.com/mythz/ServiceStack.Redis
In GitHub the Redis Client is now a self-contained, top-level project so you should be able to build without any problems.
Older binary releases (and source code) should still be available from the old project site:
http://code.google.com/p/servicestack/wiki/ServiceStackRedis
Hope this helps,
-Demis

Related

Source files mismatch when stepping into .NET Framework code

Motivation
I'm trying to track down an exception thrown by .NET Framework when opening connection to Access mdb database file. I'm not opening the database connection directly but rather use one of DevExpress Xpo facilities (XpoDefault.GetDataLayer(...) to be precise) which internally attempts to create connection to provided mdb database file. That attempt fails somewhere deep in .NET Framework code and exception is thrown.
Exception has System.Data.OleDb.OleDbException type and is very vague about the problem source. Message says "Unspecified error". ErrorCode is -2147467259 (NativeCode is 0). There is to little information to find out why database connection cannot be created. I thought that maybe going deeper into .NET Framework code would reveal something important about the failure.
Problem
Source files mismatch when stepping into .NET Framework internals. Inconsistent execution flow.
Description
My application is targeting .NET Framework 4.6.1 x86 platform and built in Debug (Release does not change anything). Visual Studio Enterprise 2019 v16.6.3 is the IDE I work with. Of course I've read all I could about debugging into .NET Framework first but it did not help to solve my problem.
What I have done so far? I have successfully download DevExpres PDBs and sources. No problem with that - I can follow execution down into DevExpress internals (which IMHO confirms that overall debugging setup is rather correct). It also seems that .NET Framework PDBs are correctly loaded from Microsoft servers during debugging. I think that Visual Studio Debugging settings are also fine (as far as I'm aware).
All goes well until I need to step into OleDbConnection.cs file which gives the following message:
The problem is that I have all .NET sources available from https://referencesource.microsoft.com. All (including updates) from version 4.5.1 up to latest 4.8.
No matter which one I choose - I'm always getting same message about not matching source file version. When I ignore the message and decide to use the source file anyway, it shortly turns out that inconsistency is real. Instead of tracking the source code execution I'm stepping over comments or execution flow simply does not make sense and clearly the presented source code is not in sync with what is going on.
Ok, that's it. I could not get any farther. Am I doing something wrong? Where to look for .NET Framework sources which would match the executing modules and allow to discover origins of the exception I'm getting?
Update #tgolisch
Code which gives an exception:
Session Session;
ReflectionDictionary reflectionDictionary;
string connectionString;
...
Session = new Session(XpoDefault.GetDataLayer(connectionString, reflectionDictionary, AutoCreateOption.SchemaOnly));
Connection string used in XpoDefault.GetDataLayer(...) call:
"Provider=Microsoft.Jet.OLEDB.4.0;Password=;User ID=Admin;Data Source=C:\\Svn\\trunk\\Apps\\bin\\Debug\\DbFile.mdb;Mode=Share Deny None;"
XopDefault.GetDataLayer(...) is the call which fails and throws exception.
Update #Perry Qian-MSFT
I did exactly what you suggested with no success. There was no improvement at all. However, I have made a fair progress after disabling optimizations of system assemblies as described here. With optimization turned off, tracking of .NET Framework internals becomes feasible. No more random jumping or stepping over comment lines.
However, it is not a full success yet, because I'm still getting messages about mismatch between executing modules and the source code file versions.
I have also noticed that even though my app has .NET Framework 4.6.1 as a target it still uses version 4.8 of system modules during execution:
That suggests I should use .NET Framework 4.8 sources when stepping into framework internals. But wait - I have tried all sources I could get with the same mismatch problem.
What can also be seen is that there is more than one version of system assemblies being run with the app - 4.8.4110.0 and 4.8.3761.0, which suggests that different sources might have been used to build them.
Yet still, no matter which sources I take there is always a message about source mismatch at some point.
Considering that assembly optimization problem has been resolved, which framework sources should I use now to have them in sync with running modules?
Source files mismatch when stepping into .NET Framework code
Please reconnect your DB Access database to refresh your database in case there are some build errors in the db layer.
Besides, please follow these suggestions to troubleshoot your strange issue:
1) Tools-->Import and Export Settings-->Reset all settings-->..General to reset all debugging settings.
2) then, close VS, delete .vs hidden folder under solution folder, bin and obj folder.

Bruel & Kjaer 2250 SDK - How to setup a C# project from scratch?

I'm trying to write a C# project that makes use of Bruel & Kjaer 2250 SDK. The SDK installer installs a VisualStudio 2015 Windows Form C# project that I'm able to build.
The next step for me was to create a similar project from scratch, so trying to do this and following litterally the BK instructions what happens is that I'm not able to create an instance of of class RemoteAPI in BK.BasicEnv.Application namespace.
I get an exception that tells me these informations:
An unhandled exception of type 'System.NullReferenceException'
occurred in BasicEnvRemoteAPI.dll
Additional information: RemoteAPI - Construction: No Instance of
EnvOfficeModel.
The constructor call is very simple:
private RemoteAPI api;
...
api = new RemoteAPI();
So the ctor of RemoteAPI is failing because an instance of EnvOfficeModel is missing to it,
I've googled a lot and made some tests but the result is always the same for my own project while the B&K example is correctly starting and is able to create an instance of the RemoteAPI class.
I also tried to compare the two projects and I'm not able to find a different setting, then I tried to search the B&K installed files and the registry for some hint about the possible causes of this behaviour, but no way ....
If some of you had the same problem and could perhaps drive me to the correct information to solve this problem will be a great thing.
I know that also a REST interface is available to communicate with BK2250 but I would like to use the native communication driver if possile.
Thank you and kind regards.
I encountered the issue today,
Verify that you imported the dll in the project correctly (Should appear under References if not it's probably the second issue)
Verify that you are using the .NET Framework and not the .NET Core
I managed to get it working with a Windows Form application using the .NET Framework 4.7.2

Silverlight web service update fails to import wsdl

We've been battling with a strange issue for a couple of days now. Have searched the net for answers but none seem to solve the error.
Our scenario is: our organization has a Silverlight 5 application, which was developed in VS 2010, and everything was working fine. It is actually running in our production servers.Recently we migrated our development machines to VS 2015, and the machines themselves (new ones for the dept). The OS is Windows 7, same as before.
At first we were welcomed with that nasty MatchTimeoutInMilliseconds error, due to the MS Framework. Eventually MS released the 4.6.2 Preview version which covered this issue.
Ok. So back to implementing the changes requested, we created a new method in our webservice, and it complied just fine. We do have the [OperationContract] and [DataContract] tags in place. There is a question posted and answered with the justification that these tags were missing.However, when we go to the SL app and update the WS reference, we get this "Custom tool error: Failed to generate code for the service reference ..."
Custom Tool Warning messages include
"Cannot import wsdl:binding..."
"Cannot import wsdl:port..."
"Cannot import wsdl:portType..."
"No endpoints compatible with Silverlight 5 were found. The generated client class will not be usable unless endpoint information is provided via the constructor."
We're puzzled, because then we thought we might have done something wrong, so we rolled back the changes, and updated the service reference with no changes, and we get the same error. The Referece.cs file is generated with no code, and all references to the webservice are no longer recognized by the compiler.
We've also read some posts that offer as a solution unchecking "Reuse types in referenced assemblies". Doing that does clear these errors, only to generate others, since our app was built on this premise.
We've also tried deleting the service reference and adding it back again, but to no avail.
Eventually we reverted the SL app to the point it was compiling, which was before updating the webservice reference, republished the WS with the new method, and manually added the new method to the Reference.cs file, tested it and it works.
This, however, should not be -the- solution. It's a hassle and prone to errors.
We'd appreciate any help in solving this matter, or an insight as to why this is happening.
thanks
The whole problem is that, for some reason I still haven't found, VS fails to generate the code for Reference.cs.
As a workaround, we've managed to generate the Reference.cs file by using the SlSvcUtil.exe tool, located (on my machine) at "c:\Program Files (x86)\Microsoft SDKs\Silverlight\v5.0\Tools".
In order to get the same code as the one generated before the migration, I've used the following command and options:
SlSvcUtil.exe my_ws_address /namespace:"*,my_class_namespace" /ct:System.Collections.ObjectModel.ObservableCollection`1 /r:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v5.0\System.Windows.dll" /edb /ser:Auto
I didn't use the /out switch, but rather ran the command on my desired output directory. But you might want to look into that switch before running the command.

Why is objectlistview not working?

I am trying to use object list view, and have followed everything. I have put the dll into my references, and have gone as far as putting it in my debug, and release folder.
The problem I am having is that it keeps giving me this error:
Is there anything I am doing that is wrong?
Take a look at this discussion thread.
Someone said they checked the FAQ and subsequently "changed the target to the full profile." It sounds like if your project is built against a client profile, you could run into this issue. I haven't downloaded the ObjectListView source myself and tried to build it to see if that's actually the case.
Check that your project is building against the full .NET framework, and not a "client profile". I use VS2012 now, which creates new projects with the full profile already set. But if you happen to be using VS2010, it created new projects with a target framework of "client profile" by default.

When compiling solution, previously working assembly reference / using no longer works [duplicate]

My C# WinForms solution has two projects.
A DLL which is the main project I'm working on, and an executable WinForms I call "Sandbox" so that I can compile/run/debug the DLL easily in one go.
I'm working in .Net 4.0 for both projects.
Everything was working fine until I added some seemingly innocent code, and a reference to System.Web in the DLL.
Now my Sandbox project can't see the namespace of the DLL project. I didn't change anything which I believe should have affected this.
If I delete the project reference to the DLL from the Sandbox references and re-add it, then the red underlines all disappear and the colour coding comes back for all my classes etc; but as as soon as I try to build the solution, the whole thing falls apart again.
When I right-click the DLL project in the Sandbox's references and view in object browser, I can see the namespace and all the stuff in there.
I have a feeling this might be some sort of bug?
Is this some sort of VS2010 bug? I had this same issue a few months ago and I could only fix it at the time by making a whole new project and re-importing my files. This time, however, I have a bajillion files and will only do that as a last resort!
Edit:
After panickedly going through and undoing all my changes, trying to find what caused the problems, it seems to be this line:
string url = "http://maps.google.com?q=" + HttpUtility.UrlEncode(address);
If I comment out this line, then I get no namespace errors and the project builds fine. I can't see anything wrong with this line though.
I'm ready to declare this a bug in VS2010, this has bitten way too many programmers already. The fix is easy: Project + Properties, Application tab, change Target Framework to ".NET Framework 4" instead of the Client Profile that is selected by default.
System.Web is not included in the client profile. Having this option in the first place is quite silly, the client profile is only 15% smaller than the full version of .NET 4.0. Having it selected by default is even sillier. But I digress.
UPDATE: mercifully this all got fixed in VS2012. Which no longer makes the client profile the default for a new project. And the client profile got retired completely in .NET 4.5, good riddance.
Check to make sure that both projects are using the non-client profile for their target framework (go to each project's properties to do this).
One possibility is that the target .NET Framework version of the class library is higher than that of the project.
I faced this problem, and I solved it by closing visual studio, reopening visual studio, cleaning and rebuilding the solution. This worked for me. On some other posts, I have read the replies and most of users solved the problem by following this way.
Try building only the project with the Sandbox dll first independently.
Then point your executable project to the required dll and ensure copy local is set to true. in reference settings.
Tthen build the executable project.
Changing the target framework from the ".NET Framweork 4 Client Profile" to ".NET Framework 4" worked for me with a similar problem. I agree that the client profile doesn't seem to have much of an advantage to using it. I seem to get nailed with weird errors that I hunt for until I remember that Visual Studio defaults to the client profile. I guess the moral of the story when getting an error is: if "Rebuild Solution" doesn't work, check the Target framework...
If you tried already doing the Framework change, and still not worked, I hope this works for you (as it did for me): Simply add the necessary references from within your projects. Very obvious but I was doing it wrong until I found what was the issue.
I just had this issue and it turned out to be I had multiple namespaces being used that had the same object name (i.e. business objects had the same names as mvc models);
Fully qualifying the names fixed the issue for me.

Categories