473,738 Members | 9,555 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Own TypeConverter - Only works after restart of Visual Studio

Hello,
the problem seems to be complex and is in all developments of web-controls
which uses own TypeConverter.
For this I have here a simple demo-program of the problem:

The Control-code: A class MyString which is a class which is similar to a
string
[TypeConverter(t ypeof(MyStringT ypeConverter))]
public class MyString
{
string str;
public MyString(string str) { this.str = str; }

public override string ToString() { return str; }

public string Str
{
get{ return str; }
set { str = value;}
}
}

the typeconverter used:

class MyStringTypeCon verter : TypeConverter
{
public override bool CanConvertFrom( ITypeDescriptor Context context,
Type sourceType)
{
if (sourceType == typeof(string))
{ return true;}
return base.CanConvert From(context, sourceType);
}
public override bool CanConvertTo(IT ypeDescriptorCo ntext context,
Type destinationType )
{
if (destinationTyp e == typeof(string))
{return true;}

else if (destinationTyp e == typeof(Instance Descriptor))
{
return true;
}

return base.CanConvert To(context, destinationType );
}
public override object ConvertFrom(ITy peDescriptorCon text context,
System.Globaliz ation.CultureIn fo culture, object value)
{
if (value is string)
{
return new MyString((strin g)value);
}
return base.ConvertFro m(context, culture, value);
}
public override object ConvertTo(IType DescriptorConte xt context,
System.Globaliz ation.CultureIn fo culture, object value, Type
destinationType )
{
if (destinationTyp e == typeof(string))
{
MyString cls = (MyString)value ;
return cls.ToString();
}
else if (destinationTyp e == typeof(Instance Descriptor))
{
ConstructorInfo ci = typeof(MyString ).GetConstructo r(new
Type[] { typeof(string) });
MyString cls = (MyString)value ;
return new InstanceDescrip tor(ci, new object[] {
cls.ToString() });
}
return base.ConvertTo( context, culture, value, destinationType );
}
}

the control-class:
[DefaultProperty ("Text")]
[ToolboxData("<{ 0}:TestCtrl02 runat=server></{0}:TestCtrl02> ")]
public class TestCtrl02 : Control
{
[Bindable(true), Category("Appea rance"),Localiz able(true)]
public MyString Text
{
get{
MyString s = (MyString)ViewS tate["Text"];
return ((s == null) ? new MyString("") : s); }

set
{ ViewState["Text"] = value; }
}

protected override void Render(HtmlText Writer writer)
............

}

using in a page:
.............
<cc1:TestCtrl 02 ID="testCtrl" runat="server" Text="my text" >
</cc1:TestCtrl02>
............... ....
xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xx

ok seems many code, but is the shortest possible to see the problem.

The problem:
The program is compiled, we now
start Visual Studio.
Now if we go in the html-view of the page we see:
<cc1:TestCtrl 02 ID="testCtrl" runat="server" Text="my text" >
</cc1:TestCtrl02>
Now we change to the design view:
the property Text now has in property view under property Text 'my text'.
If we change the text in the property and go to the html-view all is fine.
So, all works fine.
NOW: We make a RE-build of the project. Nothing more.
Now we open the page-file in html-view. All is fine.
Now we change to the design view: Error Creating Control 'my text' cannot be
set on property Text.
If we now close Visual Studio and start it again, All works fine.
If we now delete the text, and make a RE-build, so we have
<cc1:TestCtrl 02 ID="testCtrl" runat="server" >
</cc1:TestCtrl02>
we can go to design view without problems.
If we now enter in the Text-property : my text we get an error:
Property value is not valid: MyString cannot be converted to type MyString.
We now close Visual Studio and start it again and do the same.
Now it works fine.

So I know such problem allway are there when I use TypeConverter I think the
following:
After a rebuild the own type converters are not seen from the visual studio
environment.

So what maybe the reason, what can be a solution.
Developing web-controls with typconverters and to start Visual Studio after
each rebuild is impossible.

sorry it's much text, but the problem is fundamental and very important for
me.
Thank you for any help.
Rolf Welskes


Sep 28 '06 #1
11 2345
Hi Rolf,

I was able to reproduce the issue you've experiencing. I'm currently
consulting with our product team to see if this is a known issue and
whether or not there would be a workaround. Thank you for your patience and
understanding.

I do find that this issue only exists when the TypeConverter and customer
control are in another class library in the solution; if they're in
website's App_Code directory (use "__code" as the assembly name when
registering customer control), it works correctly after rebuiding the
solution.

I will get back to you as soon as possible, thank you for your feedback.

Sincerely,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Sep 29 '06 #2
Hello,
thank you for your response.
I do not work with Visual Web Designer, but with Web Projects.
This means, I do not have a App_Code directory.
So in any case I have the error, clearly the Control and the TypeConvert are
in an extra control-library.
It would be very important to have a work a round.
Thank you again.
Rolf Welskes

"Walter Wang [MSFT]" <wa****@online. microsoft.comsc hrieb im Newsbeitrag
news:pm******** ********@TK2MSF TNGXA01.phx.gbl ...
Hi Rolf,

I was able to reproduce the issue you've experiencing. I'm currently
consulting with our product team to see if this is a known issue and
whether or not there would be a workaround. Thank you for your patience
and
understanding.

I do find that this issue only exists when the TypeConverter and customer
control are in another class library in the solution; if they're in
website's App_Code directory (use "__code" as the assembly name when
registering customer control), it works correctly after rebuiding the
solution.

I will get back to you as soon as possible, thank you for your feedback.

Sincerely,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your
reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no
rights.

Sep 29 '06 #3
Hi Rolf,

Sorry for reply late.

Which Visual Studio version are you using?

I've confirmed this is an issue of Visual Studio 2005; I have reported this
problem to our product team. You are also encouraged to submit your
feedback at
http://connect.microsoft.com/Main/co...ContentID=2220. You
can use this thread as a reference.

I'm sorry that using a separate class library in the same solution, there's
no knowing workaround now. The only workaround is to use the TypeConverter
and custom server control inside the same web project using App_Code and
"__code" as the assembly name when registering the control.

If you are using Web Application Project add-on of VS2005, you can also use
the App_Code feature. Just right-click on your Web Project and add "Add
ASP.NET folder/App_Code".

If you are using Visual Studio 2003, I've verified that this issue doesn't
exist in Visual Studio 2003 SP1.

Thank you very much for your feedback on this issue. Please let me know if
there's anything I can further help.

Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 2 '06 #4
Hello,
thank you for your reply.

the workaround is not fine to develop large projects.
I hope this will be solved in a service pack.

Remark: There are also other situation when the changes in code in a
customer control is not recognized by VS2005 and the only way is to restart
VS.
In this time I have to restart VS 100 times a day or more. Not fine.

But ok.
Hope it will be solved in the next service pack.

Thank you.
Rolf Welskes


"Walter Wang [MSFT]" <wa****@online. microsoft.comsc hrieb im Newsbeitrag
news:u%******** ********@TK2MSF TNGXA01.phx.gbl ...
Hi Rolf,

Sorry for reply late.

Which Visual Studio version are you using?

I've confirmed this is an issue of Visual Studio 2005; I have reported
this
problem to our product team. You are also encouraged to submit your
feedback at
http://connect.microsoft.com/Main/co...ContentID=2220. You
can use this thread as a reference.

I'm sorry that using a separate class library in the same solution,
there's
no knowing workaround now. The only workaround is to use the TypeConverter
and custom server control inside the same web project using App_Code and
"__code" as the assembly name when registering the control.

If you are using Web Application Project add-on of VS2005, you can also
use
the App_Code feature. Just right-click on your Web Project and add "Add
ASP.NET folder/App_Code".

If you are using Visual Studio 2003, I've verified that this issue doesn't
exist in Visual Studio 2003 SP1.

Thank you very much for your feedback on this issue. Please let me know if
there's anything I can further help.

Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no
rights.

Oct 5 '06 #5
Hi Rolf,

I fully understand your concerns. I've already filed a bug for it. Thank
you very much for your feedback!

Have a nice day!

Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.
Oct 6 '06 #6
Hello,
you write:

If you are using Web Application Project add-on of VS2005, you can also use
the App_Code feature. Just right-click on your Web Project and add "Add
ASP.NET folder/App_Code".

This does not work, if you have a Web Application Project there is under the
menu point "Add ASP.Net Foller" no App_code.
Some other, but no App_Code item.

I have tried to add the folder by hand means I have added a folder App_Code.

But if I use this, there is now own dll / assembly for the code of this
folder.

Furthermore the problem to restart VS aftter each changes is not away.

Any ideeas what to do?

Thank You
Rolf Welskes


Oct 6 '06 #7
Hi Rolf,

Thanks for the update.

I checked again using Web Application Project, it already compiles the web
project into a single assembly (the name is set by project properties). So
there's no need of App_Code -- any folder will do. Apparently I missed this
point in last reply, sorry for the confusion.

So far based on my research and feebacks from consulting, only the assembly
"__code", which is generated from normal VS2005 Web Site's App_Code, are
correctly recogonized after rebuilding the whole web site.

Also, from the warnings generated by rebuilding the web project using Web
Application Project mode:

The type 'mynamespace.Te stCtrl02' in
'c:\projects\we b_wap_TypeConve rter\App_Code\C lass1.cs' conflicts with the
imported type 'mynamespace.Te stCtrl02' in
'c:\WINDOWS\Mic rosoft.NET\Fram ework\v2.0.5072 7\Temporary ASP.NET
Files\web_wap_t ypeconverter\a4 7d81e7\_shadow\ ee1b9bbd\196368 7437\29813569\w e
b_wap_TypeConve rter.DLL'. Using the one in
'c:\projects\we b_wap_TypeConve rter\App_Code\C lass1.cs'.
c:\projects\web _wap_TypeConver ter\Default.asp x.designer.cs

It seems the VS2005 IDE failed to delete the previous built assembly when
rebuilding. This should be the root cause of this issue. I will add this
updated information to the bug I opened for this issue. Thank you very much
for your feedback!

So far, the only working workaround would be have to use default Web Site
mode in VS2005 and use App_Code.

I understand this may not be feasible for your project. If it's critical
for your business, I suggest you contact PSS for further assistance.

For PSS support or a local on site, you can also try contacting the global
support center through the following link:

http://support.microsoft.com/gp/assistsupport

They will provide you the detailed info on how to contact the local
developer support center.

Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 9 '06 #8
Hello,
thank you for your work.
Hoping that it will be solved in the next service pack.

Thank you again.
Rolf Welskes
"Walter Wang [MSFT]" <wa****@online. microsoft.comsc hrieb im Newsbeitrag
news:Rd******** ******@TK2MSFTN GXA01.phx.gbl.. .
Hi Rolf,

Thanks for the update.

I checked again using Web Application Project, it already compiles the web
project into a single assembly (the name is set by project properties). So
there's no need of App_Code -- any folder will do. Apparently I missed
this
point in last reply, sorry for the confusion.

So far based on my research and feebacks from consulting, only the
assembly
"__code", which is generated from normal VS2005 Web Site's App_Code, are
correctly recogonized after rebuilding the whole web site.

Also, from the warnings generated by rebuilding the web project using Web
Application Project mode:

The type 'mynamespace.Te stCtrl02' in
'c:\projects\we b_wap_TypeConve rter\App_Code\C lass1.cs' conflicts with the
imported type 'mynamespace.Te stCtrl02' in
'c:\WINDOWS\Mic rosoft.NET\Fram ework\v2.0.5072 7\Temporary ASP.NET
Files\web_wap_t ypeconverter\a4 7d81e7\_shadow\ ee1b9bbd\196368 7437\29813569\w e
b_wap_TypeConve rter.DLL'. Using the one in
'c:\projects\we b_wap_TypeConve rter\App_Code\C lass1.cs'.
c:\projects\web _wap_TypeConver ter\Default.asp x.designer.cs

It seems the VS2005 IDE failed to delete the previous built assembly when
rebuilding. This should be the root cause of this issue. I will add this
updated information to the bug I opened for this issue. Thank you very
much
for your feedback!

So far, the only working workaround would be have to use default Web Site
mode in VS2005 and use App_Code.

I understand this may not be feasible for your project. If it's critical
for your business, I suggest you contact PSS for further assistance.

For PSS support or a local on site, you can also try contacting the global
support center through the following link:

http://support.microsoft.com/gp/assistsupport

They will provide you the detailed info on how to contact the local
developer support center.

Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no
rights.

Oct 11 '06 #9
Hi Rolf,

After I reported this issue to product team, I'm still working closely with
product team on it. After done more researching and consulting, we've found
a workaround for this issue.

The type converters go straight to the CLR's cache of type information and
do not go through the type resolution service implemented by the project
systems. This means that the CLR will return the type from the assembly it
had previously loaded prior to the rebuild - and the conversion will fail
since the type on the design surface is being loaded from the newly built
assembly. I verified that you can work around this by ensuring the version
number of the class library project gets auto-incremented on each build.
You do this by the following:
1) Bring up properties on the class library project
2) Select the "Applicatio n" tab and click the "Assembly Information..."
button.
3) In version the field set the last entry to a "*" - so it should say: 1 0
0 *

Now whenever the classlibrary is built, the revision number (the last digit
of the version) will be auto-incremented. This forces the CLR to invalidate
the entry it has cached and load the new one.

Please let me if this works for you. Thank you for your patience and
understanding in this post.

Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.
Oct 25 '06 #10

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

Similar topics

2
2195
by: João Santa Bárbara | last post by:
Hi all i have a class that i have made and i made an Typeconverter as well, and my problem is the code genereated in my form is Dim ClassTest1 As TestApplication.ClassTest = New TestApplication.ClassTest Me.MyClassTest = ClassTest1 Wich is quite good, but my problem is in my property browser i cannot change any of my properties
13
2935
by: python | last post by:
hello and thanks for reading this, i have been a dos/windows user using some form of the basic language for 30 years now. i own and run a small programming company and there is one feature that keeps me in the windows/basic world. while i will agree that it has not evolved well, it does have one awesome feature that i have yet to see replicated in any linux product that i know about so far. i am a long time windows user and have had...
2
3420
by: kw | last post by:
I'm getting different behavior from what I would expect and was hoping someone could clue me in. At run time I need to examine a property of an object for a custom TypeConverter, then use that converter on a value. Here's the deal: object attrs=(object)PropertyInfo.GetCustomAttributes(typeof(TypeConverterAttribu te),false);
1
1702
by: Sky Sigal | last post by:
(PS: Cross post from microsoft.pulic.dotnet.framework.aspnet.webcontrols) I've been looking lately for a way to keep the Properties panel for Controls 'clean'... My goal is to keep similar public properties of a custom Control neatly tied together -- rather than all over the IDE. One such set of values that will rarely be changed, so should have little priority in the IDE Properties panel, and therefore a good candidate for
2
11414
by: Brian Worth | last post by:
I have just upgraded from VB 4.0 to VB .NET 2002. One program under VB 4.0 was able to shut down or restart the (windows XP) machine using a series of API calls. (Getlasterror, GetCurrentProcess, OpenProcessToken, LookupPrivilegeValue, AdjustTokenPrivilegese, ExitWindowsEx. I am trying to avoid using any API calls if possible and to use managed code instead. I couldn't find any easy way of doing this but searching the Internet with...
0
1195
by: Alex Clark | last post by:
Hi all, Apologies for the cross-post but I can't determine if this is a VS .NET problem or a VB.NET language issue. I'm using .NET 1.1 SP1, VS 2003 EA, VB.NET. I'm coding a custom component which is designed to be dropped onto a form and have it's properties manipulated at runtime. I have a custom implementation of the TypeConverter class called UniversalTypeConverter which inherits from ExpandableObjectConverter, and for the most...
4
2177
by: Kent Boogaart | last post by:
*tried this already on the buildingcontrols newsgroup but didn't get a response* Hi, As far as I can tell, it is not possible to use the TypeConverter infrastructure with generic types. Say you have this type: public struct Id<T> where T : IComparable { ... }
4
1701
by: swartzbill2000 | last post by:
Hello, I have a TypeConverter for converting between this Enum and Strings. Public Enum DeviceNameEnum dnNone dn2500 dnMirror End Enum 'DeviceNameEnum
6
3892
by: Larry Smith | last post by:
Hi there, Can anyone provide any insight on why MSFT introduced "TypeConverter.GetProperties()". There are two classes for dealing with metadata in .NET, 'Type" and "TypeDescriptor". Each has a "GetProperites()" method so why complicate the situation even more than it already is by adding a "GetProperties()" method to "TypeConverter". The class is supposed to be for converting types so "GetProperties()" seems misplaced and redundant (as...
0
8788
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9476
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9208
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6751
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6053
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4570
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3279
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
2
2745
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.