I know that Visual Studio support for C++/CLI is terrible. But I am getting a weird issue when doing a Quick watch. The variable which I am watching is in the scope and it has value. But VS says, the variable is not in the scope. See the image
It would be great if someone can suggest a workaround. Or is this a bug with VS?
...
I have some code which handles data files and reports an error when it runs into trouble, but I'm having trouble working out how to give my class a callback function. Here's a quick example of the sort of thing I'm trying to achieve:
public delegate void Reporter( System::String^ stringToReport );
/// <summary>
/// Simple file handler ...
Hello,
I have bmp images in image folder on my computer.I named it from 1.bmp to 100.bmp .
I want to read one by one these hundered images.And I wrote this code:
int i;
System::String^s;
for(i=1;i<=100;i++)
{
s=("C:\\images\\%d.bmp",i);
System::Drawing::Bitmap^ image;
image= gcnew System::Drawing::Bitmap(s,true );
}
And VS 2008 g...
I'm trying to override Object::Equals in C++ .NET but I'm running into some difficulties
virtual bool IState::Equals(Object^ o) override{
if (o->GetType() == IState::typeid){
IState^ s = (IState^) o;
if (s->type == this->type &&
s->target_state == this->target_state &&
s->current_state == this->current_sta...
Does anybody know of any useful resources for porting a C++/CLI application written in VS2005 with .net framework 2.0 to a mobile device with .net 2.0 compact and C#? Windows Mobile doesn't support C++ CLI, so we may need to rewrite some of our applications. Through the searching I've done, everything seems to talk about porting from reg...
I'm developing an app in C++/CLI and have a csv file writing library in unmanaged code that I want to use from the managed portion. So my function looks something like this:
bool CSVWriter::Write(const char* stringToWrite);
...but I'm really struggling to convert my shiny System::String^ into something compatible. Basically I was hopi...
Try as I might, I cannot convert this Managed C++ code to C++/CLI. Can someone give a pointer (pun intended)?
static String *ignoreStrings[];
Later in the code, an Add(string) method is called on it. Elsewhere, in some C# code,
new String[]{"foo", "bar"}
is passed into a function that is somehow cast into the type of ignoreStrin...
How do you do the equivalent of:
[Test, ExpectedException( typeof(ArgumentOutOfRangeException) )]
void Test_Something_That_Throws_Exception()
{
throw gcnew ArgumentOutOfRangeException("Some more detail");
}
...in C++ (the example there is C#)? As far as I can see, there's no typeof() function for the C++ implementation of NUnit.
...
I'm trying to write a mixed-mode DLL, let's call it 'Client', to replace some unmanaged classes with their managed equivalents. Everything works fine on my personal machine, but when I check the source code in, our build machine won't build the project. It doesn't recognize the Managed classes I'm using from another DLL, called 'Core.'
...
I have a C++/CLI System::Windows::Forms::UserControl derived control which should only redraw (a small portion of) itself as new data is fed into it. For some reason though, the OnPaint mechanism is being called even when there's nothing to cause it external to the app.
Here's a snippet:
void Spectrogram::OnPaint(System::Windows::Forms...
The following example doesn't work, obviously. My question is how to make it work.
array<String^>^ MyRefClass::GetAvailableInputs()
{
List<String^>^ result = gcnew List<String^>();
DirectSoundCaptureEnumerate(&DSEnumCallback, &result);
return result->ToArray();
}
BOOL CALLBACK DSEnumCallback(LPGUID lpGuid, LPCWSTR lpcstrDescription,...
So, I have two classes...Very basic in structure. I try to import one into the other, and declare a new object of that class type...however, it seems to read the class name as the name of a variable?!
The header class provided below will not read the "ApplicationManager" class properly.
Code:
####ifndef _GAME_H_
####define _GAME_H_ ...
I am currently writing some pretty gnarly C#/C++/Cli code to interface with Telecommunication equipement and GSM Mobile Networks for a couple of the major telecom here and abroad. GSM networks primarily use SS7 Signaling using a protocol called TCAP to send messages back and forth to Signaling Points within the network. The laws of Tcp/i...
What are the various options to implement a pointer-to-member construct in C++/CLI?
I have implemented some 2D geometry algorithms which perform some actions based on X and Y co-ordinates. I find that I am frequently duplicating code once for the X-axis and once for the Y-axis. An example is finding the maximum and minimum bounds along ...
I am working on porting a large number of .h and .lib files from native C++ to Managed C++ for eventual use as a referenced .dll in C#.
Please, I know it'd be a lot easier to port the whole thing to .NET, but if I could I would. It's 3rd party and all I have are .lib(no exports) and .h files to work with.
Everything has been going smo...
I'm debugging a C++/CLI assembly. In the assembly, I have a 2D managed array declared like this:
array<char, 2> ^classifications;
I have four variables I'm using to access positions in the array:
int x, y, dx, dy;
In the Watch window, this expression works:
classifications[y, x]
However, this expression does not update when the...
I'm trying to trap any and all exceptions in a C++/CLI app so that I can log and record them (including a stack trace). So far I have some code which looked promising:
[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
// Enabling Windows XP visual effects before any controls are created
Application::EnableVisualStyles();
...
Update: After more digging this seems to be an issue with static methods and member variables. I found this post on MSDN forums, but no answer.
I am writing a C# WinForms app(.Net 2.0) with a mixed mode dll all in the same solution. When I step into native code while debugging I am unable "watch" many of the pointer variables. This seem...
I'm writing a mixed C++/CLI DLL with both managed and unmanaged classes. Both need access to string and other types of resources, like Direct3D textures.
How best to embed them within the DLL? It seems like there are several ways to do this; .resx (new style, managed), .rc (old style) which can be used to generate .resources files and (...
When using P/Invoke, adding [SuppressUnmanagedCodeSecurity] can speed calls from managed code into unmanaged code in trusted scenarios.
Is there a way to accomplish the same thing in the reverse direction, to speed things up when I call from unmanaged code back into managed code? Profiling shows a much higher overhead going in that dir...