473,547 Members | 2,553 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems with C# unsafe code...

I'm calling the C++ function below from C#:

GENCLIENT_API int CleanseEx(char ncSystem, const char *strServer,
const char **pNames, const char **pInputData,
const char **pRules, char ***pOutputData) ;

I can call this function from a console application however when I attempt
to use the same code from within a web service I get the following error:

*************** *************** *************** ************
An unhandled exception of type 'System.Web.Ser vices.Protocols .SoapException'
occurred in system.web.serv ices.dll

Additional information: Server was unable to process request. --> Object
reference not set to an instance of an object.
*************** *************** *************** ************

I'm spinning my wheels trying to figure out if this is a pointer problem or
a code access securing problem, etc... Below are the variables and method
call from my C# application:

[DllImport(@"d:\ tempdlllocation \genclient.dll" ,
arSet.Ansi,
EntryPoint="Cle anseEx")]
private unsafe static extern int CleanseEx(char SystemId, string Server,
string[]Names, string[] InputData, string[] Rules, byte*** OutputData);

int retCode;
char _SystemId = 'G';
string _Server = "TestServer ";
string[] _Names = new string[100];
string[] _Rules = new string[100];
string[] outputData = new string[100];

....... the various arrays are populated with data values.

unsafe
{
byte ** pOutput = null;
retCode = CleanseEx(_Syst emId, _Server, _Names, _InputData, _Rules, &pOutput);
..... code fails on the call above when calling from web service.
}
.......

Any help or recommendations would be really appreciated.

Nov 16 '05 #1
0 1120

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1902
by: Elidel | last post by:
Is the use of a COM object in a c# program considered 'unsafe' code ? Does the method that calls the COM object need the 'unsafe' keyword ? Is code that calls a COM object considered unmanaged? Is 'unsafe' code the same as unmanaged code ?
3
3144
by: Andre | last post by:
if I have an unsafe method that takes in two arrays, performs some operations and returns; I know that the garbage collector will not collect objects allocated inside the unsafe method. However, if I'm calling this method from a main() method of a class which is safe (i.e managed), will the allocated array (which, suppose, has been allocated...
8
5414
by: | last post by:
Wel, I am rebuilding the VC# 2002 project that I have deployment problems with the 2003 version, hoping this solves the problems, but now I encounter this wierd bug??? If I have the project, and do not compile with "Allow Unsafe Code Blocks=false" set to true, then the project compiles and no problems. BUT if I compile with "Allow Unsafe...
4
609
by: Jon Milner | last post by:
How do I declare that my code is unsafe? Sorry the help files at my University have not been installed!
17
1855
by: Bradley1234 | last post by:
Sorry if this is obvious, but Ill ask... Is there a new way of using pointer operations in C# ? Ive got a Deitel book on C# that neither mentions the word "pointer" nor "unsafe" in the index. coming from a C/C++ world, pointers make perfect sense, and getting up to speed on CS, did pointers go away?
4
4309
by: CodeTyro | last post by:
My native language being C++, I've got a few questions that a couple of hours of searching on msdn didn't answer. First, when using unsafe code and pointers, what is the C# equivalent to the C++ "delete" command? I would like to keep my memoryspace clean, but I've been unable to find a way to do it thus far. Second, I'm using structs to...
0
994
by: Robert Rae | last post by:
I'm calling the C++ function below from C#: GENCLIENT_API int CleanseEx(char ncSystem, const char *strServer, const char **pNames, const char **pInputData, const char **pRules, char ***pOutputData); I can call this function from a console application however when I attempt to use the same code from within a web service I get the following...
1
1634
by: Z | last post by:
Hello, In my C# program I have a function that uses pointers. Is there a way to tell the compiler to compile only this function with the unsafe switch and compile the remaining project as safe code? I enclosed the body of the function in unsafe block like this: public static void Foo() { unsafe
2
3376
by: NickP | last post by:
Hi there, I am currently moving my API declarations into relevant classes for Safe and Unsafe methods. My understanding is that unsafe methods are ones that require elevated security priviledges in order to perform their function. Is there a reference available as to what methods are safe and which unsafe? For example I cam currently...
0
7510
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7947
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7463
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7797
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6032
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5081
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3493
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1923
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
748
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.