Devart LinqConnect for mysql A field initializer cannot reference the non-static field, method, or property - mysql

I couldn't solve this problem after linqConnect For Mysql generated entity of models for me. I thought devart is good software, without testing trial period, I purchased their license, but now I am facing this issue, I couldn't even get it working. please help
enter image description here

The the piece of code highlighted is "System.String.Empty", nothing is wrong here. A similar problem is discussed, for example, at Visual Studio 2015: Intellisense errors but solution compiles. Have you tried to build a project ignoring these fantom errors? Most likely, the build will succeed in this case. To avoid displaying such misleading "errors", choose "Build Only" droplist value (instead of "Build + IntelliSense") in the Error List window from your screenshot.

Related

F#: How to deserialize a private discriminated union with Newtonsoft.Json?

In his question and answer from 2018, Onur Gumus used [<JsonObject(MemberSerialization = MemberSerialization.Fields)>] to enable serialization/deserialization of a discriminated union with a private constructor.
For me, the serialization works as advertised, but deserialization produces this error: "Newtonsoft.Json.JsonSerializationException: Unable to find a constructor to use for type FSI_0037+Foo. A class should either have a default constructor, one constructor with arguments or a constructor marked with the JsonConstructor attribute."
Does anyone know how to get the deserialization working? I don't want to switch to a class type if it can be avoided. However, I've tried figuring out where to place a JsonConstructor attribute without any luck. I also tried passing a settings value with the ConstructorHandling value set to AllowNonPublicDefaultConstructor, but that changed nothing.
For convenience, I copy Onur's solution here:
open Newtonsoft.Json
[<JsonObject(MemberSerialization = MemberSerialization.Fields)>]
type Foo = private Bar of string
let f = Bar "f"
let s = JsonConvert.SerializeObject(f)
let f2 = JsonConvert.DeserializeObject<Foo>(s)
printf "%A" f2
In case it matters (since things seem to have changed since 2018), I'm using .NET 5.
I am reasonably sure you have stumbled onto a bug.
When I copied the sample code you refer to into LINQPad v6.13.13, and ran it, then it worked fine. I then tried to replace the attribute with another attribute - the one I mentioned in the comment. Not unexpectedly that didn't compile. So I just reverted to the original attribute. Then I got the same compile error you encountered. That should not have happened. It's a bug. But where?
Further investigation has revealed that the compile error is produced erroneously if I do the following in LINQPad:
Open the code snippet from a file, and try to run it. This compiles and runs fine.
Comment out the attribute, and try to run it. This produces the compile error in question. This is as it should be.
Bring back the attribute, and try to run it. This should compile and run fine of course, since the source is now as it was in step 1, but it still produces the compile error in question.
Trying the same steps repeatedly will produce the same problem, whether I restart LINQPad between runs or not.
Then I tried to reproduce the problem with Visual Studio. I did not succeed - there is no such problem in VS 16.10.3
I have no more time at the moment, but will continue to investigate later. I want to check this with the latest LINQPad beta.
As for your question, was this the cause?
UPDATE
I have now checked with LINQPad v6.14.10, the current beta version. The bug is not present there. I am not surprised. As I've mentioned in a comment, the compiler is my prime suspect. Even more so because you tell you have the problem in VSCode. But there is an even more interesting detail.
LINQPad has used a very old version of the F# compiler service for ages, because there was a bug that prevented updating it. Joseph Albahari, the creator of LINQPad, recently got impatient waiting for a fix for this bug, and found a workaround. That fix is only in the beta. The huge leap in the F# compiler service version naturally means lots of bugs has been fixed, and likely this one too.
I am not going to pursue this further. I don't use VSCode, but if this problem is present even in the latest REPL there, then maybe somebody should look into it.

MS-Access References When creating VBA macros

I've been trying to develop a system where an ms-access database comunicates with a brother ql-500 label printer to print a label based on data entered to a form, but for some reason, I am using the documentation for b-Pac, the "plugin" from brother created for this interfacing and i get a syntax error in ms-access, which leads me to think there might be some problem with the references. I checked and double checked and uninstalled the plugin and installed the plugin again, up to no solution...
My question here is, is there a way to check the references to see if it is the right file?
Im very new to access programming and this was asked to do in work...
EDIT: Over this one now, it was actually bad syntax, as i was refering to documentation from another version of the bPac plugin, it seems they have changed the syntax in one of the last versions...
Now i have another problem, a runtime error: -2147023782(800705a)
EDIT 2: i solved the problem, i uninstalled through control panel and then deleted remaining files manually and proceeded to install the b pac plugin again and it works now, thank you for your help though guys ;)
I am not sure if this is what you are looking for. I haven't worked with plugins so far.
In VBA window, go to : Tools > References
This should bring up the following window :
Check to see if your plugin is refered in there, or use Browse to locate and add it to the project.
Hope this helps.

Can't get MVVMCross core project to reference System.Xml.Linq

I'm quite new to MVVMCross but I've been actively using it for two weeks, at work and in a school project, and I am really enjoying it! Unfortunately, I've been stuck on the school project for 2 days now : we're asked to do a mobile Jabber client. This is not a big deal since I started it using Matrix XMPP library, which does most of the job and is easy to use. I decided to restart my project using MVVMCross, in order to have cleaner separated code and add a Windows Phone project, but Matrix absolutely needs System.Xml.Linq, and I can't get the core PCL to compile :
The type 'System.Xml.Linq.XElement' is defined in an assembly that is not referenced.
You must add a reference to assembly 'System.Xml.Linq, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
As shown in Stuart Lodge's tutorial videos, I'm using profile 104, the the faulting dll is really present in the folder, I can't add it manually to project's references since VS prevents me from doing it (gently explaining that it's automatically loaded since .Net portable subset is included in references), I've updated and repaired my VS install "just in case"... and have no more idea left.
So, here are the questions :
is it really possible to use System.Xml.Linq with MVVMCross? or did I miss the big title explaining that what I'm trying to do is stupid?
if yes (that'd be great!) did/does someone experience the same problem? Even more interesting : did someone find a solution?
Thanks in advance!
Additional info : Windows8(x64), VS2012 Ultimate, trial license (school project...) for Xamarin.Android
UPDATE : following Stuart's answer, I compiled and ran the BestSellers sample, which uses System.Xml.Linq... without any problem. As it comes with an explicit reference to System.Xml.Linq (see first link in answer), I tried :
to delete it (and a few others) : VS holds it's promises, and really includes needed references as long as .Net Portable Subset is referenced, so everything rolls smooth.
to manually add this reference via Notepad to my .csproj : it doesn't change anything.
One thing tickles me in Stuart's answer : "perhaps it is something to do with the way the matrix uses XML.linq". Since the Matrix type I'm trying to use is just a descendant of System.Xml.Linq.XElement, which is widely used in BookViewModel.cs from sample, what could possibly be wrong with that?
"Solution" : The problem seems to be due to Matrix requiring a special version of System.Xml.Linq, which is not the one included when profile 104 for building PCL. I used file linking method as a workaround to share the core, and that works, though this is less elegant, readable, and harder to maintain...
Yes it is possible to use at least some of System.Xml.Linq
For example, see the BestSellers sample
csproj file - https://github.com/slodge/MvvmCross-Tutorials/blob/master/Sample%20-%20BestSellers/BestSellers/BestSellers/BestSellers.csproj#L49
example XML linq use - https://github.com/slodge/MvvmCross-Tutorials/blob/master/Sample%20-%20BestSellers/BestSellers/BestSellers/ViewModels/BookViewModel.cs#L44
For the problem you are seeing, I'm really not sure what the error is - perhaps it is something to do with the way the matrix uses XML.linq? You might have more luck of you open up this question to other tags like portable-class-library, XML-linq and windows-phone.

Razor exceptions

I have undoubtedly set something up wrong but frequently I get exceptions thrown by my Razor templates even though there is no problem with the templates. These are usually fixed by my doing a build.
If I do actually have an error in the template I get a popup asking me to debug in VS, but of course this does not actually allow me to debug the template.
Errors in my log are not all that helpful (see below).
Is it possible to both avoid spurious errors and get better information when there is actually a problem?
ServiceStack.Razor.Templating.TemplateCompilationException: Unable to compile template. Check the Errors list for details.
at ServiceStack.Razor.Templating.TemplateService.CreateTemplate(String template, Type modelType)
at ServiceStack.Razor.Templating.TemplateService.Compile(ViewPageRef viewPageRef, String template, Type modelType, String name)
at ServiceStack.Razor.Templating.TemplateService.Compile(ViewPageRef viewPageRef, String template, String name)
at ServiceStack.Razor.ViewPageRef.Compile(Boolean force)
I was having similar problems. I found the "easiest" way to find out what the error was, was to download all of service stack, build a debug version of the razor libary and link it into my project. I then set a break point in the ServiceStack.Razor.Templating.TemplateService.CreateTemplate method and was able to see the full exception details. From there I learnt that I had included an import in my razor page that was not referenced in my project.
Since I solved this it's been very reliable.
I had trouble with this myself, because ServiceStack swallowed the exceptions, and the logs, as you said, don't show the Errors collection. There are two ways to get that information:
Uncheck Enable Just My Code in the debugging options in Visual Studio (Debug -> Options and Settings). If you have checked Thrown for Common Language Runtime Exceptions in Debug -> Exceptions, you will get the exceptions, and be able to view the Errors collection.
A merge was committed some days ago to the ServiceStack repository, which makes it log the Errors collection. Demis Bellot apparently pushes new versions to NuGet fairly often, so it'll probably be there in a week or two.
I had the same problem. And my case, I have removed some libraries referenced in the project but the reference to them remained (eventhought I think removed it, but anyway) and this has been the problem.
After I deleted the references to libraries which don't exsits anymore in the project, it worked immediatelly.

Castle.TypedFactory.DefaultInterfaceFactoryComponentSelector could not be resolved

I am following example by José F. Romaniello on session management with NHibernate. It's a very good article, however I'm struggling with it having very little experience with NHibernate, Windsor and MVC.
I am trying to re-create NHibernateInstaller, however encountering the following error: Component Castle.TypedFactory.DefaultInterfaceFactoryComponentSelector could not be resolved. Make sure you didn't misspell the name, and that component is registered.
In the sample project provided this error does not crop up, even though the installer is identical and Google does not come up with any results (which is very unusual). What causes this and how can it be avoided?
it seems a problem with the TypedFactoryFacility... are you doing this?
kernel.AddFacility<TypedFactoryFacility>();
before running all the installers?
uncomment the following code in Bootstrapper.cs file.
container.AddFacility();
This happened to me when I created my own implementation of ITypedFactoryComponentSelector, but forgot to register the selector itself.
There was no indication this was the actual problem (and the kernel debug information assured me the components can be resolved) - but registering it fixed the issue.
Hope this helps someone :-)