Unused Entity Issue Private field 'cached_y_' is not used Xcode4.6 not an error - xcode4.6

In .h file
Getting only warnings like this
Unused Entity Issue Private field 'cached_y_' is not used Xcode4.6 not an error only warnings
int cached_y_;

Related

Conflicting types error for function taking void* in public API and typed* under the hood

I'm trying to build a 3rd party library which has a function defined in the public header as such
void reset(void* instance);
And in the implementation
void reset(instance_type* instance) {
...
}
And I'm getting a conflicting types compiler error. Now this seems obvious why to me on the surface. The author was using MSVC and I'm using gcc set to C99 standard - maybe that's why it worked on the authors machine? What's the minimal modification I can make to get this to build under the constraint that I don't want to expose the instance_type through the public interface?
What's the minimal modification I can make to get this to build under the constraint that I don't want to expose the instance_type through the public interface?
It is necessary for the definition to agree with the declaration in the header. If you don't want to expose instance_type in the public API, then that means modifying the definition to match the header:
void reset(void* _instance) {
instance_type* instance = _instance;
...
}

J2ME build fails in codenameone build sever

I am trying to build for symbian s60 in j2me and i am getting an error which i have no idea in how i can reszolve.here is the error.
Warning: com.karimtstech.imasuccess.Exercises$3: can't find enclosing
method 'void
lambda$markExercise$35(java.util.Hashtable,com.codename1.ui.Container,com.codename1.components.InteractionDialog,com.codename1.ui.events.ActionEvent)'
in class com.karimtstech.imasuccess.Exercises Warning:
com.karimtstech.imasuccess.QuestionsAnswers$3: can't find enclosing
method 'void
showAnswerInHtml(java.util.Hashtable,com.codename1.components.MultiButton,com.codename1.ui.Form,java.lang.String)'
in class com.karimtstech.imasuccess.QuestionsAnswers Note:
com.codename1.impl.midp.GameCanvasImplementation: can't find
dynamically referenced class com.siemens.mp.game.Light Note:
com.codename1.impl.midp.GameCanvasImplementation: can't find
dynamically referenced class com.motorola.phonebook.PhoneBookRecord
Note: com.codename1.impl.midp.GameCanvasImplementation: can't find
dynamically referenced class com.nokia.mid.ui.FullCanvas Note:
com.codename1.impl.midp.GameCanvasImplementation: can't find
dynamically referenced class net.rim.device.api.system.Application
Note: com.codename1.impl.midp.GameCanvasImplementation: can't find
dynamically referenced class com.mot.iden.util.Base64 Note:
com.codename1.impl.midp.GameCanvasImplementation: can't find
dynamically referenced class mmpp.media.MediaPlayer Note: there were 6
unresolved dynamic references to classes or interfaces. You should
check if you need to specify additional program jars. Warning: there
were 2 unresolved references to program class members. Your input
classes appear to be inconsistent. You may need to recompile them and
try again. Alternatively, you may have to specify the option
'-dontskipnonpubliclibraryclassmembers'. Error: Please correct the
above warnings first.
This is effectively this known issues with Java 5 compatibility for old CLDC devices.
From the post:
This can sometimes happen when inner classes reference generic parent
methods. Generally our Java 5 compatibility code converts
resp(java.util.Hashtable) to resp(codenameOneInternal.Hashtable) but
fails to do this for some unique cases of anonymous inner classes
bridge methods (special hidden methods generated to access the
argument).
So if you have:
void resp(final Hashtable x) {
new ActionListener() {
public void actionPerformed(ActionEvent e) {
x.doSomething();
}
}
}
Turn it to:
void resp(Hashtable x) {
final Object temp = x;
new ActionListener() {
public void actionPerformed(ActionEvent e) {
Hashtable x = (Hashtable)temp;
x.doSomething();
}
}
}
You can see a lot of other discussions covering this issue here.

Why Can't I Use My DbContext Type?

I'd like to access some static properties of my DbContext type in a WPF Window. I thought I could use the same XAML that I use to refer to individual entities:
<Window.Resources>
<entity:Account x:Key="account"/> //Works fine
<entity:MyEntities x:Key="myEntities"/> //Throws an error!
</Window.Resources>
I get this error:
No connection string named 'MyEntities' could be found in the application config file.
Why is it treating the DbContext type (MyEntities) differently than the Account entity? Is there an easy way I can access the static properties of my MyEntities type?
The syntax you used is for creating instances, not static properties. If you want to access a static property you need to use the x:Static markup extension
<Window.Resources>
<entity:Account x:Key="account" SomeProperty={x:Static entity:MyEntities.MyProperty}/>
</Window.Resources>
The above xaml would be similar to the C# code
var account = new Account()
{
SomeProperty = MyEntities.MyProperty
};
this.Resources["account"] = account;
See that you are calling new Account(), if you called new MyEntites() (like your original example did) you get the error you where getting.
It appears that particular error results due to the static constructor that I placed in my DbContext. When I remove the static constructor the error changes to:
Object reference not set to an instance of an object.
As it turns out, the original error doesn't prevent me from compiling or running my application. I changed my code to use Scott Chamberlain's suggestion (which produces a similar ignorable error) because it is much cleaner and I can access the static properties on the DbContext just fine in spite of Visual Studio's complaints. Thanks, everyone, for the help and suggestions.

DbContext constructor connection string error keyword name not supported

The entity framework documentation states that I can use a named parameter when supplying my connection string:
public class BloggingContext : DbContext
{
public BloggingContext()
: base("name=BloggingCompactDatabase")
{
}
}
I normally don't normally bother with the named parameter:
public TspDbContext()
: base("ViktorVooey") { }
but I thought I'd give it a go just for confirmation:
public TspDbContext()
: base("name=ViktorVooey") { }
and it fails saying
Keyword not supported : name
This is on EF6. So I'm sort of stuck between not really caring but still wanting to know "what's up with that" all the same.
I came across your post because I had the same error. The MSDN documentation for EF 6 DbContext explicitly states that the 'name=' part of the constructor string parameter is supported and means:
The name can also be passed in the form 'name=myname', in which case
the name must be found in the config file or an exception will be
thrown.
In other words the "name=" prefix forces EF to only look for a config file entry for the connection string.
So you should check that the value you pass with "name=" is actually a name key value in your config file.
For example, in the config file:
<add name="MyContextName" connectionString="blah blah"/>
In the constructor:
public MyContext()
: base("name=MyContextName")
For me this turned out to be an issue with Resharper. I suspended Resharper, built and the error went away.
After I restarted Resharper the error stayed away.

WinForms Designer Exception

A WinForms form that includes a UserControl throws an exception when I attempt to display it in design mode, but runs properly when the program is ran or debugged.
The designer says:
The variable 'fpInfoA' is either undeclared or was never assigned.
ResearchTool fMain.Designer.cs Line:282 Column:1
Call Stack
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.Error(IDesignerSerializationManager manager, String exceptionText, String helpLink)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager manager, CodeStatement statement)
However, it looks like the variable is assigned as I would expect in InitializeComponent
private void InitializeComponent()
{
// ... (Order of statements is same as in actual code) ...
this.tpFpA = new System.Windows.Forms.TabPage();
this.fpInfoA = new ResearchTool.FPInfo();
// ...
this.tpFpA.Controls.Add(this.fpInfoA); // THIS LINE BLOWS UP IN DESIGN MODE
}
Thoughts on how to track down this issue? For example, is there a way to debug initialization of the designer?
One workaround in case you can't fix the issue, would be to surround the offending bits of code with checks for DesignMode.
As in:
private void InitializeComponent()
{
...
if(!DesignMode)
{
this.fpInfoA = new ResearchTool.FPInfo();
}
...
}
This can also speed it up a little bit if it's doing things that aren't needed in design mode and that are quite slow, like connecting to databases or similar.
As Hans Olsson said, this potentially could be resolved by checking for design-mode and disabling offending logic.
This error will also trigger if there is any issue with the constructor of your UserControl. If there is an exception caused when the designer instantiates your UserControl, the designer will fail. In my case, the failure resulted in the same "[...] is either undeclared or was never assigned" error.
For example, see the following user control:
public class MyUserControl : UserControl {
public MyUserControl()
{
InitializeComponent();
throw new Exception(); //Causes a designer error.
}
}
Now, when observing the designer for a form that contains this MyUserControl, we will see something similar to the following:
I cannot say if the designer is like this for previous versions of Visual Studio; but as for Visual Studio 2017, you can clearly see what happened.
The designer failed because a System.Exception was thrown. As a result, the variable [REDACTED] was thought to be undeclared or never assigned when in fact the auto-generated designer code was correct. The issue was with the MyUserControl's constructor.
Now, if you need to put logic that depends on external services/resources inside the control's constructor, you need to indicate that it should only occur during runtime. Alternatively, you can provide mock-up resources for design-time.
To do this, you can use the LicenseManager and check its current UsageMode.
The modified code below only throws the exception in runtime now, and the designer doesn't have the error anymore.
public class MyUserControl : UserControl {
public MyUserControl()
{
InitializeComponent();
if (LicenseManager.UsageMode != LicenseUsageMode.Designtime)
{
throw new Exception(); //No longer fails in design-time.
}
}
}
You will find the information on how to trace design time code execution at:
What information do you need to fix a problem, which occurs with your products at design time?

Resources