473,399 Members | 3,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

TypeResolve & GetType()

I've a piece of code which does Type.GetType("full.type, name") on a
type that is located in an assembly that is currently not loaded.
I don't have control over the code that call this and I don't have any
control on the string that get passed.
I wanted to use TypeResolve to handle this, but it doesn't get call for
static assemblies.

Any ideas how I can handle this?

Aug 9 '05 #1
5 2243
This event is not called if the runtime knows that requested type cannot be
retieved from an assembly. Does the type you're requesting exists in the
assembly?
--
Vadym Stetsyak aka Vadmyst
<ay****@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
I've a piece of code which does Type.GetType("full.type, name") on a
type that is located in an assembly that is currently not loaded.
I don't have control over the code that call this and I don't have any
control on the string that get passed.
I wanted to use TypeResolve to handle this, but it doesn't get call for
static assemblies.

Any ideas how I can handle this?

Aug 10 '05 #2
It exists, but the assembly is not loaded, that is the problem.

Aug 10 '05 #3
If the type exists in the assembly then it seems to me that assembly is not
loaded.

Can you try to load that assembly manually and call Assembly.GetType(...)?

Also you can subscribe to AppDomain.AssemblyResolve to get notified if
something bad is happening with assembly load.

--
Vadym Stetsyak aka Vadmyst

<ay****@gmail.com> wrote in message
news:11*********************@g47g2000cwa.googlegro ups.com...
It exists, but the assembly is not loaded, that is the problem.

Aug 11 '05 #4
ay****@gmail.com wrote:
I've a piece of code which does Type.GetType("full.type, name") on a
type that is located in an assembly that is currently not loaded.
I don't have control over the code that call this and I don't have any
control on the string that get passed.
I wanted to use TypeResolve to handle this, but it doesn't get call for
static assemblies.

Any ideas how I can handle this?

use AssemblyName class to parse the ClassName, & load the assembly if
needed.
Aug 14 '05 #5
I'm already subscribing to AssemblyResolve, but it's not getting
called, and I don't know why.

Aug 16 '05 #6

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

Similar topics

1
by: phancey | last post by:
I am trying to invoke a web service method dynamically. I have created a generic function that takes a method name, string of parameters and calls the web method using System.Reflection: ...
2
by: Shmuel Cohen | last post by:
I have a class holding some enumerated types, i.e., public class MyEnums { public enum DATA_ITEM {FIRST, SECOND, THIRD,FOURTH,FIFTH}; ... } And I have a class the contains data, for example:
3
by: Fredrik Wahlgren | last post by:
Hi I found an interesting piece of code which shows how to makee an Excel automation add-in at http://www.codeproject.com/dotnet/excelnetauto.asp. I decide to experiment with it and i made a few...
3
by: ayende | last post by:
I've a piece of code which does Type.GetType("full.type, name") on a type that is located in an assembly that is currently not loaded. I don't have control over the code that call this and I don't...
1
by: | last post by:
The following code: Private Sub ClearControls(ByVal ctrl As Control) Dim i As Int32 For i = ctrl.Controls.Count - 1 To 0 Step -1 ClearControls(ctrl.Controls(i))
12
by: Michael Maes | last post by:
Hello, I have a BaseClass and many Classes which all inherit (directly) from the BaseClass. One of the functions in the BaseClass is to (de)serialize the (inherited) Class to/from disk. ...
4
by: marcmc | last post by:
Hi, I hope to create a XML file that will hold my Connection data to a SQL Db. I want to write an XML file from 4 Text Box named UserName, Password, Database & Server and later read from it. My...
1
by: Sky | last post by:
Yesterday I was told that GetType(string) should not just be with a Type, but be Type, AssemblyName. Fair enough, get the reason. (Finally!). As long as it doesn't cause tech support problems...
3
by: | last post by:
Hello, I try to open a new Window in code behind with : ClientScript.RegisterClientScriptBlock(this.GetType(), "MyOpenScript", "window.open('toto.doc');", true); My problem is that the new...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...

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.