during migration of .net framework from 4.6 to 4.6.2 on VS 2015 for one of the web related projects ran into the following problem.
The application settings are split into 2 for testing and production.
The switch used to happen in run time based on value of key value pair in a ini file.
Additional properties were added in run time by passing values from a different process.
The conversion into interface was simple by simple assignment.
For ex:
IInterface sInterface = Properties.Settings.Default;
Unfortunately this doesnt work any more after upgradation to .net 4.6.2.
Ends up with the error : cannot implicitly convert type "Properties.Settings.Default" to IInterface.
Explicit casting doesnt work either.
Tried following:
System.Convert.ChangeType ended up with System.InvalidCastException.
Any way this can be done?
Related
Have rewritten some parts of the application from VB.Net to C#. Everything is working as expected for all but one user. This user is getting this error message:
Error: Missing method 'instance void MYDLLNAME ADODB.Fields::Append(string,valuetype ADODB.DataTypeEnum,int32,valuetype ADODB.FieldAttributeEnum,object)' from class 'ADODB.InternalFields'
Is there a component potentially missing on the end user machine and is there a way to solve this or is it best to go away from ADODB.Recordset to ADO.Net Dataset?
Have seen the following questions, but they do not really solve my problem. Not upgraded framework, was already 4.5, VS 2017 used.
Strange error appending fields to recordset in VS2010 after converting to .NET 4
https://social.msdn.microsoft.com/Forums/en-US/f84cdc9c-f684-46d6-9b6f-757d047b00d5/fieldsappend?forum=Vsexpressvb
P.S. Using COM is not an option in my case.
Problem solved by setting properties of reference to ADODB in the project to:
Embed Interop = false
Copy Local = true
These are inverted defaults.
I am using Apache ignite version 2.7.5. and using .net core as server and thin client.
Cache configuration with key as string and value as Model class for example Employee.And this model class having properties including dictionary data type fields.
I am performing get and put record into cache from application which having target platform is .net framework.
In my .net core(v2.2.103) client Load() method returning result but in caller application getting the following exception.
{"No matching type found for object [typeId=596790889,
typeName=System.Collections.Generic.NonRandomizedStringEqualityComparer].
This usually indicates that assembly with specified type is not loaded
on a node. When using Apache.Ignite.exe, make sure to load assemblies
with -assembly parameter. Alternatively, set
IgniteConfiguration.PeerAssemblyLoadingEnabled to true."}
Any one can you give suggestion,how to solve this exception.
I think you have mismatch of .Net versions - one uses NonRandomizedStringEqualityComparer as comparer for its dictionaries, which other one does not have this type.
Please see this related .Net core bug: https://github.com/dotnet/corefx/issues/26033
It is possible that Ignite handles such dictionaries incorrectly on its own, but I'm not sure what are steps to reproduce. Right now the recommendation is to make sure you're using exactly the same verison of .Net runtime everywhere.
I had a working C# [DOT NET 4.6.1] project which used COM interfaces. After I added two methods to an interface, I started getting the exception "The procedure number is out of range. (Exception from HRESULT: 0x800706D1)" . This has never happened previously, and I have always been able to change COM interfaces and classes without any issues.
I found the following in MSDN support at https://msdn.microsoft.com/en-us/library/ms838933.aspx
"Contact the supplier of the running distributed application. There is a version control problem in the application that can only be fixed by the application supplier (procedures were added to an .IDL file without changing the version number)."
I tried changing the GUID of the interface, but then the I got a cast exception when trying to use the object , saying no such interface supported.
Is this a VS2017 issue (Compile does not update the build)or is it something else?
Please help!
Sagar
Is there a way of applying a default resolution to all ambigious references to a class name in a project?
To set a bit of background, I'm working on a very large project with thousands of files which was built with .NET framework 3.5. The previous coder developed a Tuple type and put it in the Utilities namespace.
However, now we want to change it to use .NET framework 4, which has System.Tuple so I have thousands of errors stating that Tuple is ambigious reference (Utilities.Tuple and System.Tuple)
Rather than having to go through the codebase and change thousands of references to this class, is there a way of saying once for the project: "Whenever Tuple is used, use Utilities.Tuple" ?
I don't think there is a solution wide fix for this, but I can see three options for refactoring:
Refactor all code to use System.Tuple and deprecate Utilities.Tuple
add using Tuple = Utilities.Tuple; in each files using statements
Solution wide search/replace Tuple with Utilites.Tuple
Right now I have a Universal Project which contains mostly business logic and models.
These I can access from both the Windows Phone project AND the Windows project.
But when I add a Background Task, I would like to access that shared logic as well, because otherwise I'd have to duplicate most of my code in my background task.
I know you can do "Add as Link", but this causes compilation errors like this:
Method 'MyProject.Model.Playlist.Tracks.get()' has a parameter of type 'System.Collections.ObjectModel.ObservableCollection' in its signature. Although this generic type is not a valid Windows Runtime type, the type or its generic parameters implement interfaces that are valid Windows Runtime types. Consider changing the type 'System.Collections.ObjectModel.ObservableCollection' in the method signature to one of the following types instead: 'System.Collections.Generic.IList, System.Collections.Generic.IReadOnlyList, System.Collections.Generic.IEnumerable'.
These can be worked away, by either using the internal keyword on functions / classes where needed, or converting my code to the suggested types.
Unfortunately, I don't think this is possible in my case, because SQLiteNet-Extensions uses the properties to determine its relations, and only certain types are supported (List, array, and I added ObservableCollection).
So I'm looking for a way to share code between my Shared project and my BackgroundTask, without getting into the "valid Windows Runtime type" errors.
You can share code between Windows Phone and Windows 8 app projects by creating a Portable Class Library. You then need to add a reference to the library in each of the projects which should use it.
Unfortunately you will be constrained to the common denominators across the target frameworks. MSDN details these. Available members for PCL and your target frameworks will appear in Intellisense.