I'm using Farseer in my XNA project, but I have some trouble with the ContactListener. I created a class for my ContactListener but I always get these two error messages and I don't know how to fix the problems.
The type or namespace name 'ContactListener' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'ContactImpulse' could not be found (are you missing a using directive or an assembly reference?)
What is wrong with my ContactListener class?
class MyContactListener: ContactListener
{
void BeginContact(Contact contact)
{ /* handle begin event */ }
void EndContact(Contact contact)
{ /* handle end event */ }
void PreSolve(Contact contact, ref Manifold oldManifold)
{
Fixture fixtureA = contact.FixtureA;
Fixture fixtureB = contact.FixtureB;
if (fixtureB.CollisionCategories == Category.Cat10)
{
contact.Enabled = false;
}
}
void PostSolve(Contact contact, ref ContactImpulse impulse)
{ /* handle post-solve event */ }
}
Try this:
Open VS
Go to the Solution Explorer window
Search for a folder called References and right click it
Select Add Reference...
look for the Farseer assembly and add it
And try adding these in code:
using FarseerPhysics.Collision.Shapes;
using FarseerPhysics.Common;
using FarseerPhysics.Dynamics;
using FarseerPhysics.Dynamics.Contacts;
using FarseerPhysics.Factories;
using FarseerPhysics.TestBed.Framework;
using Microsoft.Xna.Framework;
Related
I tried this.GameObject<SpriteRenderer>().sprite = spriteName; but it doesn't seem to work it just give me the error:
The type or namespace name 'sprite' could not be found (are you
missing a using directive or an assembly reference?)
public void TheBlueCircle()
{
this.GameObject.GetComponent<SpriteRenderer>().sprite = BlueCircle;
}
this.GameObjectis incorrect. You need to use the instance of GameObject and not the class so it will be this.gameObject.GetComponent<>()
In many cases, this.gameObject is not required, so you can probably just write GetComponent<>()
I'm trying to follow the basic tutorial for FakeXrmEasy, but I'm not sure why I'm getting errors. I installed everything that needs to be installed to mock Dynamics 365, but I'm still getting errors. I can't figure out what I'm missing, I really want to be able to use this tool.
CS1950 The best overloaded Add method 'List.Add(Entity)' for the collection initializer has some invalid arguments unitTest c:\Users\acapell\documents\visual studio 2015\Projects\unitTest\unitTest\Program.cs 48 Active
CS0246 The type or namespace name 'Account' could not be found (are you missing a using directive or an assembly reference?) unitTest c:\Users\acapell\documents\visual studio 2015\Projects\unitTest\unitTest\Program.cs 45 Active
Didn't know if I was suppose to create an account class, I also tried that but that didn't work either. I got
CS1503 Argument 1: cannot convert from 'unitTest.Account' to 'Microsoft.Xrm.Sdk.Entity' unitTest c:\Users\acapell\documents\visual studio 2015\Projects\unitTest\unitTest\Program.cs 48 Active
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;
using FakeItEasy;
using FakeXrmEasy;
using Microsoft.Xrm.Sdk;
namespace unitTest
{
class Program
{
static void Main(string[] args)
{
}
}
class unitTest
{
public object ProxyTypesAssembly { get; private set; }
public void MyFirstTest()
{//test method body
var context = new XrmFakedContext();
//You can think of a context like an Organisation database which stores entities In Memory.
//We can also use TypedEntities but we need to tell the context where to look for them,
//this could be done, easily, like this:
context.ProxyTypesAssembly = Assembly.GetAssembly(typeof(Account));
//We have to define our initial state now,
//by calling the Initialize method, which expects a list of entities.
var account = new Account() { Id = Guid.NewGuid(), Name = "My First Faked Account yeah!" };
context.Initialize(new List<Entity>() {
account
});
}
}
}
Do you use early binding in your CRM project and got the references right? If you do not use early binding, you can try late binding, e.g.
//context.ProxyTypesAssembly = Assembly.GetAssembly(typeof(Account));
var account = new Entity();
account.LogicalName = "account";
account.Attributes["name"] = "your account name";
I have a game developed for iOS as well as android, Here is the code which suddenly started giving an error "Assets/GooglePlayGames/Platforms/PlayGamesClientFactory.cs(31,40): error CS0234: The type or namespace name IOS' does not exist in the namespaceGooglePlayGames'. Are you missing an assembly reference?
"
Here is the code:
using System;
using UnityEngine;
using UnityEngine.SocialPlatforms;
using GooglePlayGames.BasicApi;
namespace GooglePlayGames {
internal class PlayGamesClientFactory {
internal static IPlayGamesClient GetPlatformPlayGamesClient() {
if (Application.isEditor) {
return new GooglePlayGames.BasicApi.DummyClient();
}
#if UNITY_ANDROID
return new GooglePlayGames.Android.AndroidClient();
#elif UNITY_IPHONE
return new GooglePlayGames.IOS.IOSClient();
#else
return new GooglePlayGames.BasicApi.DummyClient();
#endif
}
}
}
Error is on the line:
return new GooglePlayGames.IOS.IOSClient();
The use of the platform dependent define "UNITY_IPHONE" is marked as Deprecated.
Unity documentation mentions UNITY_IOS as the new PLatform dependent define for the iOS platform.
http://docs.unity3d.com/Manual/PlatformDependentCompilation.html
The line of GooglePlayGames.IOS.IOSClient(); should be correct. ( not test in my code but the corresponding github archive shows the class in that place.)
Include using GooglePlayGames.IOS; at the top of your file.
I have downloaded the Roslyn CTP and have run across the following error.A CompilationErrorException is thrown when executing the line session.Execute(#"using System.Linq;"); with the following message:
(1,14): error CS0234: The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?)
My code is:
namespace RoslynError
{
using System;
using Roslyn.Scripting;
using Roslyn.Scripting.CSharp;
internal class RoslynError
{
static void Main(string[] args)
{
var engine = new ScriptEngine();
Session session = engine.CreateSession();
session.Execute(#"using System.Collections;");
session.Execute(#"using System.Linq;");
Console.ReadKey();
}
}
}
I'm especially confused as to why the System.Linq line throws an error while System.Collections is fine.
The engine needs a reference to the assembly that the System.Linq namespace is in (System.Core.dll)
engine.AddReference(typeof(System.Linq.Enumerable).Assembly.Location);
This needs to be done before the session is created.
I am trying to load a certain page though WebBrowser control while avoiding unnecessary advertisement banners which load in DIV element called 'tb'.
How can I do this? I have done some googling and found an example using mshtml reference but I can't make it work from this example: https://stackoverflow.com/a/1218875
Any ideas?
Why wouldn't this work?
using System;
using mshtml;
using System.Windows.Forms;
namespace Client
{
public partial class Client : Form
{
public Client()
{
InitializeComponent();
HTMLDocumentClass htmldoc = wbBrowser.Document.DomDocument as HTMLDocumentClass;
IHTMLDOMNode node = htmldoc.getElementById("tb") as IHTMLDOMNode;
node.parentNode.removeChild(node);
}
}
}
I get an error:
'mshtml.HTMLDocumentClass' does not contain a definition for 'getElementById' and no extension method 'getElementById' accepting a first argument of type 'mshtml.HTMLDocumentClass' could be found (are you missing a using directive or an assembly reference?)
And:
Interop type 'mshtml.HTMLDocumentClass' cannot be embedded. Use the applicable interface instead.
You can do this using:
IHTMLDocument3 htmldoc = wbCtrl.Document.DomDocument as IHTMLDocument3;
IHTMLDOMNode node = htmldoc.getElementById("xBar") as IHTMLDOMNode;
node.parentNode.removeChild(node);