Encoding Error - No data is available for encoding 1252

Encoding Error - No data is available for encoding 1252

william
Advocate Advocate
1,145 Views
4 Replies
Message 1 of 5

Encoding Error - No data is available for encoding 1252

william
Advocate
Advocate

I have started getting this error in Inventor 2025.

I believe this one is due to the change to .Net Core from framework.

 

"System.NotSupportedException: No data is available for encoding 1252. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.
at Microsoft.VisualBasic.Strings.StrConv(String str, VbStrConv Conversion, Int32 LocaleID)
at ThisRule.Main() in rule: iProperties, in document FRAME WELDMENT_FERO_4-LEG.ipt:line 18
at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
at Autodesk.iLogic.Exec.AppDomExec.ExecCodeHere()
at Autodesk.iLogic.Exec.AppDomExec.ExecCodeInOtherDomain(AppDomain otherDomain, String assemName)
at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)

 

No data is available for encoding 1252. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method."

 

The offending line is:

StrConv(Classification,VbStrConv.ProperCase)

 

How can I add this encoding method? 

0 Likes
Accepted solutions (1)
1,146 Views
4 Replies
Replies (4)
Message 2 of 5

Curtis_Waguespack
Consultant
Consultant

@william , I've known a couple of people seeing this error with add-ins that worked fine in 2024 or earlier, but throw this error in 2025.  I have not seen Autodesk give any information about how to address it though.

 

Your error appears to be from an iLogic rule and not an add-in. Can you confirm that this is/is not the case ?

 

@MjDeck , @johnsonshiue 

 

 

EESignature

0 Likes
Message 3 of 5

william
Advocate
Advocate

Thats correct. Just an iLogic rule. 
All I am trying to do is format an inventor text parameter to proper case. 
It has worked fine in previous versions. 

Message 4 of 5

MjDeck
Autodesk
Autodesk
Accepted solution

This is caused by the move from .NET Framework 4.8 to .NET 8 in Inventor 2025.

To get the rule to work in Inventor 2025, add this at the top:

 

AddReference "System.Text.Encoding.CodePages"
Imports System.Text

Encoding.RegisterProvider(CodePagesEncodingProvider.Instance)

 

@Curtis_Waguespack , similar code will also work in an add-in.

(For this particular function, there is also a newer method  TextInfo.ToTitleCase. But that will not convert a string that is ALL CAPS.)


Mike Deck
Software Developer
Autodesk, Inc.

Message 5 of 5

william
Advocate
Advocate

Champion! Works nicely.