Problem with System.Data with Sybase SQL Anywhere and Windows CE - vb.net

I am moving a vb.net application from Oracle Lite to Sybase SQL anywhere. I have made several code changes but have a specific error that is driving me mad. All of this is in Visual Studio 2005.
When I compile the code it gives me the following error "Reference required to assembly 'System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' containing the base class 'System.Data.Common.DbCommand'. Add one to your project".
I have both System and System.Data added for the WindowsCE platform and these worked fine under the Oracle Lite system. I have removed and re-added these files to the project. Nothing seems to be working to get rid of the error.
The offending code is legion, one example is:
Public con As ULConnection
Any thoughts here would be very helpful!

A public Key Token of b77a5c561934e089 indicates a full framework, not compact framework, assembly. Something you're using (likely the version of SQL Anywhere you have) was built referencing the desktop System.Data assembly, which is not going to work on a device. You need assemblies built specifically targeting the Compact Framework.

Related

Alter Assembly not altering an assembly

Recently we have noticed that ALTER ASSEMBLY is not updating the dll on the SQL Server. We have been altering the assembly since last two years and never had an issue before. The major change we have done is upgraded the targetted framework on the assembly to 4.8. I don't think this is an issue because we were able to alter another assembly on which we have upgraded the framework to 4.8. We have even decompiled the assembly and validated that our latest code is part of it. When we tracked the ModifiedDate in sys.assemblies, realized that the dll has not been updated. It is still pointing to the old date, while the other dlls got a latest modified date.
No errors or warnings are logged on the SSMS and SQL Server event viewer while running the Alter Assembly. We are not sure why is the assembly not updating. Please help us in resolving this issue.
Thanks

only supports language versions up to Visual Basic 2012

[EDIT: It is a memory issue. The memory on my computer goes from 42% used to 91% in a few seconds just before this error. The error message about the compiler supporting up to 2012 is just a red-herring. That message is always output from the compiler. ]
I just converted a visual basic application from VS2005 to VS2017.
I get this error when I try to start it:
Server Error in '/' Application.
Compilation Error Description: An error occurred during the
compilation of a resource required to service this request. Please
review the following specific error details and modify your source
code appropriately.
Compiler Error Message: The compiler failed with error code
-2147024888.
Show Detailed Compiler Output:
C:\Program Files (x86)\IIS Express> Microsoft (R) Visual Basic
Compiler version 14.7.2556 for Visual Basic 2012 Copyright (c)
Microsoft Corporation. All rights reserved.
This compiler is provided as part of the Microsoft (R) .NET Framework,
but only supports language versions up to Visual Basic 2012, which is
no longer the latest version. For compilers that support newer
versions of the Visual Basic programming language, see
http://go.microsoft.com/fwlink/?LinkID=533241
Version Information: Microsoft .NET Framework Version:4.0.30319;
ASP.NET Version:4.7.2556.0
Here is what I tried:
Followed the fwlink and it actually redirects to github that appears to be some open source version of the compiler that will support my old code. I have no interest in doing that.
Reading the answers to this question: Compilation Error when change .Net framework from 4.5.2 to 4.5 in VS 2015 Community edition
I tried to follow the instructions, but those instructions seem to be for a MVC project and my project is a Web project [Note: I am new to Visual Studio so I probably have that wrong] but what I am sure of is:
a. I don't have a project file.
b. I see a globe icon on my project.
c. When I right click on the project (globe icon thing in solution explorer) I do NOT get a Properties menu item.
So, how do I get past this error where my preference is to update my code to current techniques rather than patch together libraries to get it to run.
[EDIT] This problem just occurred on a different project/solution that actually does have a project file. This was converted from VS2005 to VS2017 a couple of months ago and has been working fine. I suspect some configuration change in VS2017 that is affecting all solutions.
[EDIT] The comment about out of memory seems promising except it fails in exactly same spot every time. A reboot did not help. This is an i7 with 16GB and 500GB SSD with 400GB free. If it is running out of memory it might be some config in VS that artificially limits memory of that particular process. I am going to deeper into this lead.
[EDIT] I have IIS Express 10.0.1740 installed.
[EDIT] I tried installing the Roslyn compiler using nuget. The error message did not change, but it could be I need to do some additional config to get it to be the compiler used for this solution/project. The problem is happening while the application is running so presumably iisexpress is doing the compiling.
[EDIT] This is also happening on a different project that does have a .vbproj file. I suspect some update that is causing the issue.
[EDIT] I am now testing in a project that has a .vbproj file. To change target framework I do Project -> XXX Properties -> Application -> Target Framework 4.6.1. The problem still happens. Note the warning in the message that it may require additional hand edits. I did not know what to edit, so I did not make other changes.
[EDIT] Note that the compiler version is 14.7.2556 And it is complaining about being for VB2012. This seems to conflict with https://en.wikipedia.org/wiki/Visual_Basic_.NET that says that vb compiler 14.0 came out in 2015.
[EDIT] I did not have a section in web.config, so there is nothing to remove.
[EDIT] I do not have a compilerOptions= tag in web.config, so there is nothing to change.
With a an i7 with 16GB and 500GB SSD with 400GB free I doubt this is a memory issue, I'm guessing the ERROR_NOT_ENOUGH_MEMORY is a symptom of the root cause:
This compiler is provided as part of the Microsoft (R) .NET Framework, but only supports language versions up to Visual Basic 2012,
In other words the compiler only works with projects upto 2012, so lets just change what commpiler we use by targeting an up-to-date version of the .Net Framework (right click on Project > Property Pages):
You also can safely remove the CodeDom that's used for Dynamic Compilation in the web.config:
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701"/>
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+"/>
</compilers>
</system.codedom>
Or you could change the compilerOptions="/langversion:6 compiler version.
If this doesn't work, make a cut down https://stackoverflow.com/help/mcve in VS2005 that we can reproduce the problem with and upload the solution somewhere we can download it.
#jmcilhinney you were on the right track. I worked with #Michael Potter and found that, on the local machine, IIS is having trouble doing the just-in-time compile a "Website" requires. I've no deeper knowledge than that (and not sure I want any) but the issue was fixed (in this case) by switching to HTML pages (it is mostly a SPA site).
Had we more code-behind than we do, I would simply switch to a "Web Application".

Run-time error -2146234341 (8013101b) Automation error from VB.NET to VB6, using manifest?

I am trying to access a VB.NET DLL (.NET FX 4.0) from a VB6 client in a reg-free scenario.
I tried to follow the example from http://msdn.microsoft.com/en-us/library/ms973915.aspx, but with no success. I downloaded (link in the article) the sources and compiled, no success (error message: Run-time error '-2146234341 (8013101b)': Automation error"). Running from VB6 IDE using registered VB.NET DLL works.
I tried other examples where the .NET DLL is created as a COM Class (using "COM Class" template from VS2010), with manifest for referenced DLL embedded or not, but nothing worked for me.
Can somebody provide some simple source code with manifests example of VB.NET DLL (.NET FX v4) used in VB6 client in reg-free scenario?
Thanks much in advance.
Run-time error '-2146234341 (8013101b)': Automation error
Your problem doesn't have anything to do with a manifest, you'll need to fix this one first. The error code is COR_E_NEWER_RUNTIME. In other words, your [ComVisible] class cannot be loaded because it depends on CLR version 4. And the program has already loaded the CLR, version 2 most likely, because another [ComVisible] class asked first. And it asked for version 2.
You'll need an app.exe.config file that forces CLR version 4 to get loaded, even when somebody asks for version 2. It should look like this:
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>
</configuration>
Give it the same name as the vb6 exe (like "foo.exe.config" to match "foo.exe") and put it in the same directory as the .exe. If you want to use the VB6 IDE to debug your vb6 code that uses this library then you also need vb6.exe.config in c:\program files\microsoft visual studio\vb98

Unable to find assembly A_class, Version 2.0.0.0, Culture=neutral, PublicKeyToken=null

I am trying to upgrade a project from VS2005. It is a VB.NET project B that depends on a C# project that references a C++ dll, A.dll. I am getting an error saying 'Unable to find assembly A_class, Version 2.0.0.0, Culture=neutral, PublicKeyToken=null'. The targeted platform of the C++ project is 4.0 and since that project depends on others, I can't downgrade it. But I did set the platform for the VB.NET project to 4.0. What else does the Version 2.0.0.0 refer to ? I have tried to create a brand-new project and added the vb forms into it after I have built it successfully. The C++ dll is in the output directory, if the VB project doesn't find it there, it doesn't get to this point. During build. I either get no error (but forms don't load) or I get 2 errors (one for each form):
error MSB3103: Invalid Resx file. Could not load file or assembly 'A-class, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format. Line 136, position 5.
Please help me, give me a suggestion, I don't know where to look. thank you very much.
"An attempt was made to load a program with an incorrect format"
99% of the time this means you are trying to load a 32-bit assembly using 64-bit tools, or vice versa. The version number in the error message just means the version number of the assembly that it's trying to load; it has nothing to do with .NET version being targeted. In this case it appears that the resource compiler is what has issues.
Try configuring your solution to explicitly build x86 instead of Any CPU and see if that resolves your problem.

Can't reference Microsoft.Moles.Framework.dll in Visual Studio 2010 SP1

Actually I already resolved this issue but still I'm not really happy with the way I resolved this issue.
I have VS2010 SP1 and I need SP1 to work with Azure SDK.
First of all installing Pex and Moles somehow created problems with System.XML.dll. It just disappeared from References in all projects. I had to explicitly find it and connect it to all solutions that used it.
Also, there was a bigger issue with Moles itself. TestProjects just weren't able to find
Microsoft.Moles.Framework.dll. And it generated all kinds of errors.
When I tried to add reference to Microsoft.Moles.Framework in "Add Refernce" dialog I got message: "Microsoft.Moles.Framework, Version=0.94.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" is incompatible with .NET Framework 4
Solution was to explicitly add reference to Microsoft.Moles.Framework.dll in C:\Program Files\Microsoft Moles\PublicAssembliesSilverlight. And after that all works fine so far.
I hope this info can be helpfull to someone.