|
There's no place here for insults
go back and reread
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Quote: “No exports were found that match the constraint” error in Visual Studio
I could go on, but it's "hopeless".
The fact your "turn-around" time was so short, you:
a) didn't read it
b) and can't be bothered
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
I spent 2 days researching this Google hits are all about some kind of VS problem.
So let's just assume that you're here to troll, and not help, so unless you have a serious response... don't.
if you dont have a solution to the problem, dont reply
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
You think your snotty replies should go unchallenged? No problem in the future.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
So I'm not sure why you took my responses the way you did, as I certainly didn't mean any offense.
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Kevin Marois wrote: So let's just assume that you're here to troll, and not help, so unless you have a serious response... don't. Not the first time you utter that accusation.
In the previous thread you keep hammering on the idea that nothing changed; in which case, the output and behaviour would be the same still, so evidently, something changed. Most of the stuff I read keeps pointing to a change in VS MEF by NuGet, and you stated it only happens on your machine.
So you broke your dev-environment; if you don't have the patience to evaluate suggestions, your best course of action is to rebuild a clean dev-environment. I'd first be trying to get rid of anything MEF-related and redownload only the stuff that's needed.
That is, without using NuGet for anything, and installing stuff by hand so you can control exactly what is installed.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
I didn't mean to offend anyone. But as I said in my OP, I tried the Google result suggestions. None of what worked. Those posts all say that when VS was opened, the error occured. That's not what's happening here. I can open VS and run other apps with no issues.
It's just this one app that throws this, and only when I RUN the app, not open it.
And As I said before nothing changed. Literally NOTHING. At least in VS or the code. I was working Friday afternoon. Monday morning this started. I guess some Windows update could have been applied. But what Windows update would only affect THIS app?? So I serioualy doubt I 'broke' my dev environment.
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Kevin Marois wrote: I didn't mean to offend anyone. Neither did I, so sorry if my bluntness did. Still learning to not take some stuff personally.
Kevin Marois wrote: Those posts all say that when VS was opened, the error occured. That's not what's happening here. I can open VS and run other apps with no issues. Any MEF in those other apps? I'm guessing that VS loads some package on demand, and seriously dislike the idea that it auto-updates some dependencies.
The WinForms-designer (and the controls on it) are also only loaded if you open the form using the designer; since I don't use it, some errors only pop up when running.
Kevin Marois wrote: I was working Friday afternoon. Monday morning this started. Turned of the PC when you left?
You probably have the project under source control. Did you also check in the built versions, or are they excluded? If you haven't changed anything, then one of the dependencies probably did. And yes, very frustrating if something changes under your feet.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
OK, so I completely removed all the source from my PC, rebooted, got lastest from SCM, and voila!! It now works.
It doesn't make any sense, but now it works.
Thanks for all your help
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Good to hear it's working again
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
How are you starting your application? Is this being run from inside Visual Studio or Explorer? I have seen similar issues in the past when I am running from VS if I have a dependency on a NuGet package that uses MEF where I need to physically delete the bin and obj folders and then do a rebuild. Sometimes I have had to empty my NuGet cache beforehand as well.
|
|
|
|
|
I'm runninig it from VS.
Last Friday it was running. Monday I came and and attempted to run and this error started showing up. Between Friday and Monday there were no changes.
As I said in my original post, I tried the Google result fixes, which all seem to point to some kind of VS error when OPENING VS. I can run other solutuins. This is NOT a Visual Studio problem. The message sure seems like MEF, which the app is using.
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
I wasn't suggesting the Google fixes. What I suggested was you doing a full rebuild. When you run from Visual Studio, you can incur rebuilds which could have ended up messing it up.
|
|
|
|
|
|
Hello all friends,
I am newbee here right now, i'm trying to solve my problem code but it's doesn't clear.
I want to get value from my string textBox.Text. initial textBox is hmI7Segment1.Text. it's has string Format as "Channel1.DV1.DB1.Level1". i wish to convert double value from this string into textBoxTarget.Text.
so, here is code problem:
hmI7Segment1.Text = "Channel1.DV1.DB1.Level1";
TextBox txtBoxTarget = converted.Format [hmI7Segment1.Text] as TextBox;
if all of you have solution, please help me to solve my case. thanks for all of you are.
Marbun
|
|
|
|
|
Hey there! I'm slightly confused, are you trying to change the text in a text box? Or a particular box?
Basically is txtBoxTarget a specific box?
|
|
|
|
|
Or a particular box?
|
|
|
|
|
The textbox doesn't contain a number: is contains a string which contains numeric values, but nothing that is immediately recognisable as a number anyone could use.
I suspect that you need to go back to your specification or task description and read it a little more carefully: that string implies that the textbox contains a description of a device which has the value you want, rather than the value itself; and that you need to use that string to access the correct information on a specific part of that device.
And we can't help you do that: we have no idea what the device is, how it's connected, or how to ask it for information! Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
If you're thinking of utilizing "predefined" string formats, perhaps this is what you want:
String.Format Method (System) | Microsoft Docs
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Hi all, I'm currently working on a side project. I need to click on locations on the screen where an image has been found. I have gotten the code to work but its not as reliable as i would like. I successfully got the project running, and working, but as I stated before its just not reliable. The cameras location has to be EXACTLY in the same space for the bitmaps to line up. I've got some code that ill share below that I am using to find the bitmap, but I have no idea if I've done this efficiently. I'm doing all the work in Visual Studio, as that's what I've used since college. Here is the code I've thrown together for the bitmap search.
private bool FindBitmap(Bitmap bmpNeedle, Bitmap bmpHaystack, out Point location, out Point locationA)
{
Random rnd = new Random();
int rndmousex = rnd.Next(-5, 5);
int rndmousey = rnd.Next(-5, 5);
for (int outerX = 0; outerX < bmpHaystack.Width - bmpNeedle.Width; outerX++)
{
for (int outerY = 0; outerY < bmpHaystack.Height - bmpNeedle.Height; outerY++)
{
for (int innerX = 0; innerX < bmpNeedle.Width; innerX++)
{
for (int innerY = 0; innerY < bmpNeedle.Height; innerY++)
{
Color cNeedle = bmpNeedle.GetPixel(innerX, innerY);
Color cHaystack = bmpHaystack.GetPixel(innerX + outerX, innerY + outerY);
if (cNeedle.R != cHaystack.R || cNeedle.G != cHaystack.G || cNeedle.B != cHaystack.B)
{
goto notFound;
}
}
}
location = new Point(outerX + rndmousex, outerY + rndmousey);
locationA = new Point(outerX, outerY);
return true;
notFound:
continue;
}
}
location = Point.Empty;
locationA = Point.Empty;
return false;
}
private Bitmap Screenshot()
{
Bitmap bmpScreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
Graphics g = Graphics.FromImage(bmpScreenshot);
g.CopyFromScreen(0, 0, 0, 0, Screen.PrimaryScreen.Bounds.Size);
return bmpScreenshot;
}
Now I run this and say I have the bitmap of the Facebook login page have it click and login (I don't!) it will ALWAYS find it, never with any issues. Now say i go into Diablo for example how can i search for a bitmap of just a particular sword and ignore the background? I have tried to make the background of the bitmaps transparent in hopes that it would only search for the sword itself but it'll never find it. It searches for the transparency I'm guessing, or am I just not cleaning my bitmaps enough?
|
|
|
|
|
It will search for an exact copy of the first bitmap. Diablo will have their sword not copied into the background as a bitmap, but will blend it into the existing frame with some shadowing and stuff.
You could try to count the amount of pixels that are "found" and try to guess that it's there if more than 90% of the original is found.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Just plain brilliant, i didn't think of that! I'll have an attempt at that today. Thank you for the direction!
I'll try something like this and pray that it does what id'e like.
static void Main()
{
Bitmap img1 = new Bitmap("Lenna50.jpg");
Bitmap img2 = new Bitmap("Lenna100.jpg");
if (img1.Size != img2.Size)
{
Console.Error.WriteLine("Images are of different sizes");
return;
}
float diff = 0;
for (int y = 0; y < img1.Height; y++)
{
for (int x = 0; x < img1.Width; x++)
{
Color pixel1 = img1.GetPixel(x, y);
Color pixel2 = img2.GetPixel(x, y);
diff += Math.Abs(pixel1.R - pixel2.R);
diff += Math.Abs(pixel1.G - pixel2.G);
diff += Math.Abs(pixel1.B - pixel2.B);
}
}
I found this chunk of code online, and i believe that it would get the job done with some nasty fiddling. I would need to actually break this down and throw it into the search of my screen right?
modified 3-Feb-20 11:20am.
|
|
|
|
|
Yes; that would give an indication of how different the bitmaps are - but it won't be very fast, and may break if the sword is drawn a pixel higher then where you expect it to be.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Attempting this bit instead. Its going need a ton of modification in my existing code but i think i can make it work.
public static bool CompareBitmapsFast(Bitmap bmp1, Bitmap bmp2)
{
if (bmp1 == null || bmp2 == null)
return false;
if (object.Equals(bmp1, bmp2))
return true;
if (!bmp1.Size.Equals(bmp2.Size) || !bmp1.PixelFormat.Equals(bmp2.PixelFormat))
return false;
int bytes = bmp1.Width * bmp1.Height * (Image.GetPixelFormatSize(bmp1.PixelFormat) / 8);
bool result = true;
byte[] b1bytes = new byte[bytes];
byte[] b2bytes = new byte[bytes];
BitmapData bitmapData1 = bmp1.LockBits(new Rectangle(0, 0, bmp1.Width, bmp1.Height), ImageLockMode.ReadOnly, bmp1.PixelFormat);
BitmapData bitmapData2 = bmp2.LockBits(new Rectangle(0, 0, bmp2.Width, bmp2.Height), ImageLockMode.ReadOnly, bmp2.PixelFormat);
Marshal.Copy(bitmapData1.Scan0, b1bytes, 0, bytes);
Marshal.Copy(bitmapData2.Scan0, b2bytes, 0, bytes);
for (int n = 0; n <= bytes - 1; n++)
{
if (b1bytes[n] != b2bytes[n])
{
result = false;
break;
}
}
bmp1.UnlockBits(bitmapData1);
bmp2.UnlockBits(bitmapData2);
return result;
}
I believe i can make it work though. Hopefully. This would be faster right?
modified 3-Feb-20 15:05pm.
|
|
|
|
|
Face-recognition and OCR (text-recognition) usually use a AI trained for recognizing. There's some articles on CodeProject that do so, often using Emgu VC.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|