|
What is your %PATH% after installing .NET?
I was just reading through a .net book and they said to run ildasm.exe from start/run. Apparently I didn't have the proper path in my environment variable. Did something goof up during my install?
Todd Smith
|
|
|
|
|
As far as I know the path isn't set if you run the setup from VS.NET, but you are prompted to set the path if you install the SDK separately.
In anycase, add %WINDIR%\Microsoft.NET\[framework version]\ to your path.
James
Simplicity Rules!
|
|
|
|
|
I have the following method that instantiates a specified class in a given .NET assembley with specified activation attributes.
HRESULT LoadCORClassEx(
BSTR AssemblyName, /* mscorlib */
BSTR typeName, /* System.Text.RegularExpressions.Regex */
REFIID riid,
void **ppv,
SAFEARRAY *args)
{
HRESULT hr = S_OK;
if(ppv == NULL) return E_POINTER;
*ppv = 0;
/*** debug ***/
VARIANT var;
HRESULT hresult;
long ix = 0;
VariantInit(&var);
hresult = SafeArrayGetElement( args, &ix, &var);
if(FAILED(hresult)) return hresult;
/*** end debug ***/
CComPtr<_ObjectHandle> spHandle;
spHandle.p = g_host.spDefaultAppDomain->CreateInstance_2(
AssemblyName,
typeName,
args);
CComVariant unwrapped;
unwrapped = spHandle->Unwrap();
if (unwrapped.vt != VT_UNKNOWN && unwrapped.vt != VT_DISPATCH)
return E_UNEXPECTED;
return unwrapped.punkVal->QueryInterface(riid, ppv);
}
I can get the contents of the args SAFEARRAY that is passed into this method into a variant -- shown in the debugger as {"abc" VT_BSTR} -- before the subsequent call to CreateInstance_2(), however, when I step into the call to CreateInstance_2(), the underlying raw_CreateInstance_2() call in mscorlib.tli blows up .
Can anyone see what I am doing wrong here? I tried adding the save /*** debug ***/ code to mscorlib.tli in order to peek at the content of the SAFEARRAY being passed for activation attributes, but the debugger seems to ignore the added code...
Thanks for any insights!
--
Roy
|
|
|
|
|
Sometimes this may happen if you forgot to call SysAllocString to allocate the BSTR. Make sure that you are not doing anything like
VARIANT vt;
vt.vt = VT_BSTR;
vt.bstrVal = OLESTR("Test");
Check the same for other BSTR's
|
|
|
|
|
The code that creates the SAFEARRAY looks like the following:
HRESULT hRes;
VARIANT Placeholder;
LPCTSTR str = session->GetString((pbstring)(pbvArgs[i]->GetString( session )));
_bstr_t bstr_val( str );
Placeholder.bstrVal = SysAllocString( bstr_val );
hRes = SafeArrayPutElement( psaArgs, &Place, &Placeholder );
if (hRes != S_OK)
{
pbrRet = PBX_E_INVOKE_FAILURE;
}
VariantClear(&Placeholder);
The SAFEARRAY is then passed to another call:
LoadCORClassEx (bstr_1, bstr_2, IID_IUnknown, (void**)&pIDispatch, psaArgs);
Do you see anything else that I might be doing wrong?
Thanks,
Roy
|
|
|
|
|
Are you allocating the SAFEARRAY?
|
|
|
|
|
Yes, see code below:
SAFEARRAYBOUND sabArgs[1];
sabArgs[0].cElements = size;
sabArgs[0].lLbound = 0;
SAFEARRAY FAR* psaArgs = new SAFEARRAY;
psaArgs = SafeArrayCreate( VT_VARIANT, 1, sabArgs );
</p>
|
|
|
|
|
This is plain wrong. This is not the way you allocate a SAFEARRAY.
For creating 1 dimensional array use the following code
SAFEARRAY FAR* psaArgs =SafeArrayCreateVector(VT_VARIANT, 0, size);
Next call SafeArrayLockData
VARIANT* rgVtVals = NULL;
SafeArrayLockData(psaArgs, (VARIANT**)&rgVtVals);
Then start filling rgVtVals
Finally unlock
SafeArrayUnlockData(psaArgs);
|
|
|
|
|
I could not find references to SafeArrayLockData or SafeArrayUnlockData -- did you intend for me to use SafeArrayAccessData and SafeArrayUnaccessData? Those seem to match the parameters.
--
Thanks,
Roy
|
|
|
|
|
Sorry yes I mean SafeArrayAccessData and safeArrayUnaccessData
|
|
|
|
|
I'm trying to get the wrox book samples working on my system:
http://www.wrox.com/ACON12H4.asp?WROXEMPTOKEN=160192ZjePJD4tgkFUWWDBumUS&ISBN=1861005644
I tried this at home on XP and at work on 2K and both of my machines produce the same error.
I can't figure out if it's an IIS configuration problem or a code problem (is an assembly requred?)
Can anyone get these samples to work?
I get the following errors when trying to run the Chapter01\CompositeControl.aspx sample:
Server Error in '/aspsc' Application.
--------------------------------------------------------------------------------
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: File or assembly name CompositeControl, or one of its dependencies, was not found.
Source Error:
Line 1: <%@ Register TagPrefix="Custom" Namespace="CompositeControl" Assembly = "CompositeControl" %>
Line 2: <%@ Page Language="c#" Debug="true" %>
Line 3:
Source File: F:\alchdev\Professional ASP.NET Server Controls - Building Custom Controls with C#\Chapter01\CompositeControl.aspx Line: 1
Assembly Load Trace: The following information can be helpful to determine why the assembly 'CompositeControl' could not be loaded.
=== Pre-bind state information ===
LOG: DisplayName = CompositeControl
(Partial)
LOG: Appbase = file:///F:/alchdev/Professional ASP.NET Server Controls - Building Custom Controls with C#
LOG: Initial PrivatePath = bin
Calling assembly : (Unknown).
===
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Post-policy reference: CompositeControl
LOG: Attempting download of new URL file:///D:/WINNT/Microsoft.NET/Framework/v1.0.3705/Temporary ASP.NET Files/aspsc/52a1ba08/5db97123/CompositeControl.DLL.
LOG: Attempting download of new URL file:///D:/WINNT/Microsoft.NET/Framework/v1.0.3705/Temporary ASP.NET Files/aspsc/52a1ba08/5db97123/CompositeControl/CompositeControl.DLL.
LOG: Attempting download of new URL file:///F:/alchdev/Professional ASP.NET Server Controls - Building Custom Controls with C#/bin/CompositeControl.DLL.
LOG: Attempting download of new URL file:///F:/alchdev/Professional ASP.NET Server Controls - Building Custom Controls with C#/bin/CompositeControl/CompositeControl.DLL.
LOG: Attempting download of new URL file:///D:/WINNT/Microsoft.NET/Framework/v1.0.3705/Temporary ASP.NET Files/aspsc/52a1ba08/5db97123/CompositeControl.EXE.
LOG: Attempting download of new URL file:///D:/WINNT/Microsoft.NET/Framework/v1.0.3705/Temporary ASP.NET Files/aspsc/52a1ba08/5db97123/CompositeControl/CompositeControl.EXE.
LOG: Attempting download of new URL file:///F:/alchdev/Professional ASP.NET Server Controls - Building Custom Controls with C#/bin/CompositeControl.EXE.
LOG: Attempting download of new URL file:///F:/alchdev/Professional ASP.NET Server Controls - Building Custom Controls with C#/bin/CompositeControl/CompositeControl.EXE.
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.0.3705.209; ASP.NET Version:1.0.3705.0
Todd Smith
|
|
|
|
|
I had my control in a subdirectory of the web root
\webroot\test\bin\mycontrol.dll
\webroot\test\mycontrol.aspx
That gave me the following error
File or assembly name MyControl, or one of its dependencies, was not found.
To fix it all I had to do was move the \bin dir to the root
\webroot\bin\mycontrol.dll
\webroot\test\mycontrol.aspx
and it worked!
Todd Smith
|
|
|
|
|
With all this emphesis on .NET and the internet. Why is there not class in the new .NET Framework to parse HTML tags?
|
|
|
|
|
well, if you use xhtml, you can just use the built in xml namespace.
otherwise, you could use com interop to talk to ie.
|
|
|
|
|
Ok, I built a test web service using VS.NET. How do I call the web methods within this service remotely? I want to call the service from a machine with no .NET Framework or IDE installed.
Previously I used Microsoft's SOAP Toolkit to create a web service from an existing com object. It was easy to call the service in vb script by creating a soap client object, all I need to know was the url of the .wsdl file for the service.
But there is no .wsdl file in my .NET web service project. How do I access this service? Please help.
Thanks.
|
|
|
|
|
You can use the SOAP toolkit for this also.
You access the WSDL by sticking ?WSDL onto the end of the URL
e.g. http://localhost/webservice.asmx?WSDL
Dave.
|
|
|
|
|
Thanks. I already tried that. The problem is, SOAP toolkit doesn't seem to be compatible with .NET web service. I always got an error saying something like "SoapPort failed, etc.".
|
|
|
|
|
Not sure it this is what you are looking for, but you could invoke web service method(s) via HTTP GET or POST.
Mike M
WinInsider.com
|
|
|
|
|
Hi
Is it Possible to Create a Setup From VS.Net , to Setup the .Net Fram work it self?
Thanks.
Gaurika.
Gaurika Wijeratne. // www.gaurika.com
|
|
|
|
|
If you are familiar with Windows Installer (.msi files) there is a merge module you can use to install the framework.
Unfortunately, I'm not familiar with Windows Installer so I have no idea what you do with it
James
Simplicity Rules!
|
|
|
|
|
Wht is the Fastest from vb.net, c# and Managed C++ ?
Gaurika Wijeratne. // www.gaurika.com
|
|
|
|
|
If I remember correctly Managed C++ is just a smidge faster than C#; C# and VB.NET are about the same after JIT, but VB.NET produces a lot of no-op IL opcodes, which get compiled away.
James
Simplicity Rules!
|
|
|
|
|
Thanks James
What is no-op ?
Gaurika Wijeratne. // www.gaurika.com
|
|
|
|
|
Its an instruction to do nothing.
I'm not sure of Intel processor's but the Sparc requires nop (the sparc name for no-op) before you do any branching (ie goto).
James
Simplicity Rules!
|
|
|
|
|
Thanks..
Gaurika Wijeratne. // www.gaurika.com
|
|
|
|